SparseTextureAlloc check for GL_NV_deep_texture3D
authorLiam Middlebrook <lmiddlebrook@nvidia.com>
Fri, 19 Jan 2018 23:04:34 +0000 (15:04 -0800)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Tue, 6 Feb 2018 09:11:00 +0000 (04:11 -0500)
When running the
SparseTextureAllocationTestCase::verifyTexStorageInvalidValueErrors test
we need to check if the GL_NV_deep_texture3D extension is supported. If
so we can't compare the depth of the texture against the
GL_MAX_3D_TEXTURE_SIZE attribute that is intended for symmetric texture
limits. Instead we need to check against GL_MAX_DEEP_3D_TEXTURE_DEPTH_NV
provided the texture width and height are within the acceptable ranges
for a deep texture.

Components: OpenGL

VK-GL-CTS issue: 959

Change-Id: I0e404d6851724b0624d0802603a12aea3af220e5
Reviewed-by: ewerness
external/openglcts/modules/gl/gl4cSparseTextureTests.cpp

index 062b36f..d05ea09 100644 (file)
@@ -1504,6 +1504,22 @@ bool SparseTextureAllocationTestCase::verifyTexStorageInvalidValueErrors(const F
                        return false;
                }
 
+               // Check for GL_NV_deep_texture3D support, if so we'll need to check
+               // against the depth limit instead of the generic 3D texture size limit
+               if (m_context.getContextInfo().isExtensionSupported("GL_NV_deep_texture3D"))
+               {
+
+                       // Ensure that width and height are within the valid bounds for a
+                       // deep texture
+                       GLint maxTextureWidthHeight;
+                       gl.getIntegerv(GL_MAX_DEEP_3D_TEXTURE_DEPTH_NV, &maxTextureWidthHeight);
+
+                       if (width < maxTextureWidthHeight && height < maxTextureWidthHeight)
+                       {
+                               gl.getIntegerv(GL_MAX_DEEP_3D_TEXTURE_DEPTH_NV, &max3DTextureSize);
+                       }
+               }
+
                Texture::Storage(gl, target, 1, format, width, height, depth + max3DTextureSize);
                if (!SparseTextureUtils::verifyError(mLog, "TexStorage [GL_TEXTURE_3D wrong depth]", gl.getError(),
                                                                                         GL_INVALID_VALUE))