[Piglit] [PATCH 03/12] arb_internalformat_query2: being more strict with the format/type inferred from internalformat

Alejandro PiƱeiro apinheiro at igalia.com
Fri May 13 15:26:04 UTC 2016


For max-dimensions test we are trying to create a texture based on the
target and internalformat, in order to confirm if it is supported or not.

gles seems to be more strict on the type/format used, so we need to
be more careful.

This commit helps to get max-dimensions test passing on gles.

Acked-by: Eduardo Lima <elima at igalia.com>
Acked-by: Antia Puentes <apuentes at igalia.com>
---
 tests/spec/arb_internalformat_query2/common.c | 100 ++++++++++++++++++++++----
 1 file changed, 88 insertions(+), 12 deletions(-)

diff --git a/tests/spec/arb_internalformat_query2/common.c b/tests/spec/arb_internalformat_query2/common.c
index 6d05368..0e8e15d 100644
--- a/tests/spec/arb_internalformat_query2/common.c
+++ b/tests/spec/arb_internalformat_query2/common.c
@@ -342,34 +342,50 @@ static GLenum
 format_for_internalformat(const GLenum internalformat)
 {
         switch(internalformat) {
-        case GL_DEPTH_COMPONENT:
-        case GL_DEPTH_COMPONENT16:
-        case GL_DEPTH_COMPONENT24:
-        case GL_DEPTH_COMPONENT32:
-        case GL_DEPTH_COMPONENT32F:
-                return GL_DEPTH_COMPONENT;
-        case GL_DEPTH_STENCIL:
-        case GL_DEPTH24_STENCIL8:
-        case GL_DEPTH32F_STENCIL8:
-                return GL_DEPTH_STENCIL;
-        case GL_RGB10_A2UI:
+        case GL_RED:
+        case GL_R8:
+        case GL_R8_SNORM:
+        case GL_R16F:
+        case GL_R32F:
+        case GL_COMPRESSED_RED:
+                return GL_RED;
         case GL_R8I:
         case GL_R8UI:
         case GL_R16I:
         case GL_R16UI:
         case GL_R32I:
         case GL_R32UI:
+                return GL_RED_INTEGER;
+        case GL_RG:
+        case GL_RG8:
+        case GL_RG8_SNORM:
+        case GL_RG16F:
+        case GL_RG32F:
+                return GL_RG;
         case GL_RG8I:
+        case GL_RG8UI:
         case GL_RG16I:
         case GL_RG16UI:
         case GL_RG32I:
         case GL_RG32UI:
+                return GL_RG_INTEGER;
+        case GL_RGB:
+        case GL_RGB8:
+	case GL_RGB8_SNORM:
+        case GL_SRGB8:
+        case GL_RGB16F:
+        case GL_RGB32F:
+        case GL_R11F_G11F_B10F:
+        case GL_RGB9_E5:
+                return GL_RGB;
         case GL_RGB8I:
         case GL_RGB8UI:
         case GL_RGB16I:
         case GL_RGB16UI:
         case GL_RGB32I:
         case GL_RGB32UI:
+                return GL_RGB_INTEGER;
+        case GL_RGB10_A2UI:
         case GL_RGBA8I:
         case GL_RGBA8UI:
         case GL_RGBA16I:
@@ -377,6 +393,17 @@ format_for_internalformat(const GLenum internalformat)
         case GL_RGBA32I:
         case GL_RGBA32UI:
                 return GL_RGBA_INTEGER;
+        case GL_DEPTH_COMPONENT:
+        case GL_DEPTH_COMPONENT16:
+        case GL_DEPTH_COMPONENT24:
+        case GL_DEPTH_COMPONENT32:
+        case GL_DEPTH_COMPONENT32F:
+                return GL_DEPTH_COMPONENT;
+        case GL_DEPTH_STENCIL:
+        case GL_DEPTH24_STENCIL8:
+        case GL_DEPTH32F_STENCIL8:
+                return GL_DEPTH_STENCIL;
+
         default:
                 return GL_RGBA;
         }
@@ -386,10 +413,59 @@ static GLenum
 type_for_internalformat(const GLenum internalformat)
 {
         switch(internalformat) {
+        case GL_R8I:
+        case GL_R8_SNORM:
+        case GL_RG8I:
+        case GL_RG8_SNORM:
+        case GL_RGB8I:
+        case GL_RGBA8I:
+	case GL_RGB8_SNORM:
+	case GL_RGBA8_SNORM:
+                return GL_BYTE;
+        case GL_R16I:
+        case GL_RG16I:
+        case GL_RGB16I:
+        case GL_RGBA16I:
+                return GL_SHORT;
+        case GL_R16UI:
+        case GL_RG16UI:
+        case GL_RGB16UI:
+        case GL_RGBA16UI:
+        case GL_DEPTH_COMPONENT16:
+                return GL_UNSIGNED_SHORT;
+        case GL_R32I:
+        case GL_RG32I:
+        case GL_RGB32I:
+        case GL_RGBA32I:
+        case GL_DEPTH_COMPONENT32:
+                return GL_INT;
+        case GL_R32UI:
+        case GL_RG32UI:
+        case GL_RGB32UI:
+        case GL_RGBA32UI:
+        case GL_DEPTH_COMPONENT:
+        case GL_DEPTH_COMPONENT24:
+                return GL_UNSIGNED_INT;
         case GL_DEPTH_STENCIL:
         case GL_DEPTH24_STENCIL8:
-        case GL_DEPTH32F_STENCIL8:
                 return GL_UNSIGNED_INT_24_8;
+        case GL_RGB10_A2:
+        case GL_RGB10_A2UI:
+                return GL_UNSIGNED_INT_2_10_10_10_REV;
+        case GL_R16F:
+        case GL_RG16F:
+        case GL_RGB16F:
+        case GL_RGBA16F:
+        case GL_R32F:
+        case GL_RG32F:
+        case GL_RGB32F:
+        case GL_RGBA32F:
+        case GL_R11F_G11F_B10F:
+        case GL_RGB9_E5:
+        case GL_DEPTH_COMPONENT32F:
+                return GL_FLOAT;
+        case GL_DEPTH32F_STENCIL8:
+                return GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
         default:
                 return GL_UNSIGNED_BYTE;
         }
-- 
2.7.4



More information about the Piglit mailing list