Ensure vertex shader presence if a geometry shader exists
authorAlexander Galazin <alexander.galazin@arm.com>
Mon, 8 May 2017 12:59:38 +0000 (14:59 +0200)
committerMika Isojärvi <misojarvi@google.com>
Tue, 11 Jul 2017 17:29:18 +0000 (10:29 -0700)
Certain tests verify that INVALID_OPERATION is generated
if a geometry shader is active and mode is incompatible with
the input primitive type of the geometry shader in the currently
installed program object. However these tests have no vertex shader and
this is the real reason why INVALID_OPERATION is generated.
This change ensures that the vertex shader is present.

Components: AOSP

Affects:
dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_elements_base_vertex_primitive_mode_mismatch
dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_elements_instanced_base_vertex_primitive_mode_mismatch
dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_range_elements_base_vertex_primitive_mode_mismatch

Change-Id: I36bcee8892e4f641feadb0b444a53ed35273b727

modules/gles31/functional/es31fNegativeVertexArrayApiTests.cpp

index 5c282ec..ffad380 100644 (file)
@@ -721,8 +721,12 @@ void draw_elements_base_vertex_invalid_map (NegativeTestContext& ctx)
 
 void draw_elements_base_vertex_primitive_mode_mismatch (NegativeTestContext& ctx)
 {
-       GLfloat                         vertices[1];
-       glu::ShaderProgram      program (ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << glu::GeometrySource(geometryShaderSource));
+       GLfloat                                         vertices[1];
+       map<string, string>                     args;
+       const bool                                      isES32  = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
+       args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
+
+       glu::ShaderProgram                      program(ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << glu::VertexSource(tcu::StringTemplate(vertexShaderSource).specialize(args)) << glu::GeometrySource(geometryShaderSource));
 
        ctx.beginSection("GL_INVALID_OPERATION is generated if a geometry shader is active and mode is incompatible with the input primitive type of the geometry shader in the currently installed program object.");
        ctx.glUseProgram(program.getProgram());
@@ -1102,7 +1106,10 @@ void draw_elements_instanced_base_vertex_invalid_map (NegativeTestContext& ctx)
 void draw_elements_instanced_base_vertex_primitive_mode_mismatch (NegativeTestContext& ctx)
 {
        GLfloat                                         vertices[1];
-       glu::ShaderProgram                      geometryProgram (ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << glu::GeometrySource(geometryShaderSource));
+       map<string, string>                     args;
+       const bool                                      isES32  = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
+       args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
+       glu::ShaderProgram                      geometryProgram(ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << glu::VertexSource(tcu::StringTemplate(vertexShaderSource).specialize(args)) << glu::GeometrySource(geometryShaderSource));
 
        ctx.beginSection("GL_INVALID_OPERATION is generated if a geometry shader is active and mode is incompatible with the input primitive type of the geometry shader in the currently installed program object.");
        ctx.glUseProgram(geometryProgram.getProgram());
@@ -1383,8 +1390,11 @@ void draw_range_elements_base_vertex_invalid_map (NegativeTestContext& ctx)
 
 void draw_range_elements_base_vertex_primitive_mode_mismatch (NegativeTestContext& ctx)
 {
-       GLfloat                         vertices[1];
-       glu::ShaderProgram      geometryProgram (ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << glu::GeometrySource(geometryShaderSource));
+       GLfloat                                         vertices[1];
+       map<string, string>                     args;
+       const bool                                      isES32  = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
+       args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES);
+       glu::ShaderProgram                      geometryProgram(ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << glu::VertexSource(tcu::StringTemplate(vertexShaderSource).specialize(args)) << glu::GeometrySource(geometryShaderSource));
 
        ctx.beginSection("GL_INVALID_OPERATION is generated if a geometry shader is active and mode is incompatible with the input primitive type of the geometry shader in the currently installed program object.");
        ctx.glUseProgram(geometryProgram.getProgram());