From f5f087e9bd571b5aee3b810957af7051cd82d2c0 Mon Sep 17 00:00:00 2001 From: Alexander Galazin Date: Mon, 8 May 2017 14:59:38 +0200 Subject: [PATCH] Ensure vertex shader presence if a geometry shader exists 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 --- .../functional/es31fNegativeVertexArrayApiTests.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/modules/gles31/functional/es31fNegativeVertexArrayApiTests.cpp b/modules/gles31/functional/es31fNegativeVertexArrayApiTests.cpp index 5c282ec..ffad380 100644 --- a/modules/gles31/functional/es31fNegativeVertexArrayApiTests.cpp +++ b/modules/gles31/functional/es31fNegativeVertexArrayApiTests.cpp @@ -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 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 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 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()); -- 2.7.4