Fix extension support checks in negative api tests
authorGraeme Leese <gleese@broadcom.com>
Thu, 23 Feb 2017 16:56:10 +0000 (16:56 +0000)
committerPierre Couillaud <pierre@broadcom.com>
Sat, 25 Feb 2017 01:43:05 +0000 (17:43 -0800)
Add checks for tessellation and geometry shader support for negative
shader storage and primitive bounding box tests.

Move all uses of cubemap array textures inside the extension checks in
the texture tests.

Bug: 29835218
Change-Id: I6051fff231285ed7d9c71015c2bb11a9fc7b909b
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
modules/gles31/functional/es31fNegativeShaderDirectiveTests.cpp
modules/gles31/functional/es31fNegativeShaderStorageTests.cpp
modules/gles31/functional/es31fNegativeTextureApiTests.cpp

index c2c3f42..8d87a21 100644 (file)
@@ -539,42 +539,48 @@ void executeAccessingBoundingBoxType (NegativeTestContext& ctx, const std::strin
 
        sourceStream.str(std::string());
 
-       ctx.beginSection("cannot access built-in type " + builtInTypeName + "[]" + " in tessellation evaluation shader");
-       sourceStream    << version
-                                       << extensionPrim
-                                       << extensionTess
-                                       << "layout (triangles, equal_spacing, ccw) in;\n"
-                                       << "void main()\n"
-                                       << "{\n"
-                                       << "    " + builtInTypeName + "[0] = vec4(1.0, 1.0, 1.0, 1.0);\n"
-                                       << "    gl_Position = ( gl_TessCoord.x * " +  builtInTypeName + "[0] +\n"
-                                       << "                                    gl_TessCoord.y * " +  builtInTypeName + "[0] +\n"
-                                       << "                                    gl_TessCoord.z * " +  builtInTypeName + "[0]);\n"
-                                       << "}\n";
-       verifyShader(ctx, glu::SHADERTYPE_TESSELLATION_EVALUATION, sourceStream.str(), EXPECT_RESULT_FAIL);
-       ctx.endSection();
+       if (ctx.isShaderSupported(glu::SHADERTYPE_TESSELLATION_EVALUATION))
+       {
+               ctx.beginSection("cannot access built-in type " + builtInTypeName + "[]" + " in tessellation evaluation shader");
+               sourceStream    << version
+                                               << extensionPrim
+                                               << extensionTess
+                                               << "layout (triangles, equal_spacing, ccw) in;\n"
+                                               << "void main()\n"
+                                               << "{\n"
+                                               << "    " + builtInTypeName + "[0] = vec4(1.0, 1.0, 1.0, 1.0);\n"
+                                               << "    gl_Position = ( gl_TessCoord.x * " +  builtInTypeName + "[0] +\n"
+                                               << "                                    gl_TessCoord.y * " +  builtInTypeName + "[0] +\n"
+                                               << "                                    gl_TessCoord.z * " +  builtInTypeName + "[0]);\n"
+                                               << "}\n";
+               verifyShader(ctx, glu::SHADERTYPE_TESSELLATION_EVALUATION, sourceStream.str(), EXPECT_RESULT_FAIL);
+               ctx.endSection();
 
-       sourceStream.str(std::string());
+               sourceStream.str(std::string());
+       }
 
-       ctx.beginSection("cannot access built-in type " + builtInTypeName + "[]" + " in geometry shader");
-       sourceStream    << version
-                                       << extensionPrim
-                                       << "layout (triangles) in;\n"
-                                       << "layout (triangle_strip, max_vertices = 3) out;\n"
-                                       << "void main()\n"
-                                       << "{\n"
-                                       << "    " + builtInTypeName + "[0] = vec4(1.0, 1.0, 1.0, 1.0);\n"
-                                       << "    for (int idx = 0; idx < 3; idx++)\n"
-                                       << "    {\n"
-                                       << "            gl_Position = gl_in[idx].gl_Position * " + builtInTypeName + "[0];\n"
-                                       << "            EmitVertex();\n"
-                                       << "    }\n"
-                                       << "    EndPrimitive();\n"
-                                       << "}\n";
-       verifyShader(ctx, glu::SHADERTYPE_GEOMETRY, sourceStream.str(), EXPECT_RESULT_FAIL);
-       ctx.endSection();
+       if (ctx.isShaderSupported(glu::SHADERTYPE_GEOMETRY))
+       {
+               ctx.beginSection("cannot access built-in type " + builtInTypeName + "[]" + " in geometry shader");
+               sourceStream    << version
+                                               << extensionPrim
+                                               << "layout (triangles) in;\n"
+                                               << "layout (triangle_strip, max_vertices = 3) out;\n"
+                                               << "void main()\n"
+                                               << "{\n"
+                                               << "    " + builtInTypeName + "[0] = vec4(1.0, 1.0, 1.0, 1.0);\n"
+                                               << "    for (int idx = 0; idx < 3; idx++)\n"
+                                               << "    {\n"
+                                               << "            gl_Position = gl_in[idx].gl_Position * " + builtInTypeName + "[0];\n"
+                                               << "            EmitVertex();\n"
+                                               << "    }\n"
+                                               << "    EndPrimitive();\n"
+                                               << "}\n";
+               verifyShader(ctx, glu::SHADERTYPE_GEOMETRY, sourceStream.str(), EXPECT_RESULT_FAIL);
+               ctx.endSection();
 
-       sourceStream.str(std::string());
+               sourceStream.str(std::string());
+       }
 
        ctx.beginSection("cannot access built-in type " + builtInTypeName + "[]" + " in fragment shader");
        sourceStream    << version
index 773d728..31d425e 100644 (file)
@@ -214,12 +214,18 @@ void block_number_limits (NegativeTestContext& ctx)
        {
                ctx.beginSection("maxShaderStorageBlocks: Exceed limits");
 
+               if (!ctx.isShaderSupported(static_cast<glu::ShaderType>(getGLUShaderType(glShaderTypes[ndx]))))
+               {
+                       ctx.endSection();
+                       continue;
+               }
+
                int                                     maxSSBlocks                     = getMaxSSBlockSize(ctx, glShaderTypes[ndx]);
                std::string                     source                          = genBlockSource(ctx, maxSSBlocks+1, glShaderTypes[ndx]);
 
                glu::ProgramSources sources;
 
-               if (maxSSBlocks == 0 || !ctx.isShaderSupported(static_cast<glu::ShaderType>(getGLUShaderType(glShaderTypes[ndx]))))
+               if (maxSSBlocks == 0)
                {
                        ctx.endSection();
                        continue;
index 6038b40..52f7146 100644 (file)
@@ -2916,8 +2916,6 @@ void texsubimage3d_neg_level (NegativeTestContext& ctx)
        ctx.glTexImage3D                (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
        ctx.glBindTexture               (GL_TEXTURE_2D_ARRAY, textures[1]);
        ctx.glTexImage3D                (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
-       ctx.glBindTexture               (GL_TEXTURE_CUBE_MAP_ARRAY, textures[2]);
-       ctx.glTexImage3D                (GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 4, 4, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
        ctx.expectError                 (GL_NO_ERROR);
 
        ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
@@ -2928,6 +2926,10 @@ void texsubimage3d_neg_level (NegativeTestContext& ctx)
 
        if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
        {
+               ctx.glBindTexture               (GL_TEXTURE_CUBE_MAP_ARRAY, textures[2]);
+               ctx.glTexImage3D                (GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 4, 4, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+               ctx.expectError                 (GL_NO_ERROR);
+
                ctx.glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, -1, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
                ctx.expectError(GL_INVALID_VALUE);
        }
@@ -2971,8 +2973,6 @@ void texsubimage3d_neg_offset (NegativeTestContext& ctx)
        ctx.glTexImage3D                (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
        ctx.glBindTexture               (GL_TEXTURE_2D_ARRAY, textures[1]);
        ctx.glTexImage3D                (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
-       ctx.glBindTexture               (GL_TEXTURE_CUBE_MAP_ARRAY, textures[2]);
-       ctx.glTexImage3D                (GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 4, 4, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
        ctx.expectError                 (GL_NO_ERROR);
 
        ctx.beginSection("GL_INVALID_VALUE is generated if xoffset, yoffset or zoffset are negative.");
@@ -2995,6 +2995,10 @@ void texsubimage3d_neg_offset (NegativeTestContext& ctx)
 
        if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
        {
+               ctx.glBindTexture               (GL_TEXTURE_CUBE_MAP_ARRAY, textures[2]);
+               ctx.glTexImage3D                (GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 4, 4, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+               ctx.expectError                 (GL_NO_ERROR);
+
                ctx.glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, -1, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
                ctx.expectError(GL_INVALID_VALUE);
                ctx.glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, 0, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);