From 8e2e670007a31f2dcdf5f260bc2f902701ee6a0a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sun, 2 Dec 2012 14:24:31 -0800 Subject: [PATCH] mesa: Emit errors for geometry shader enums when ARB_gs4 is not supported Signed-off-by: Ian Romanick Reviewed-by: Kenneth Graunke --- src/mesa/main/shaderapi.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index bf738b94185..b921be3b24e 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -1571,6 +1571,9 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value) switch (pname) { case GL_GEOMETRY_VERTICES_OUT_ARB: + if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4) + break; + if (value < 1 || (unsigned) value > ctx->Const.MaxGeometryOutputVertices) { _mesa_error(ctx, GL_INVALID_VALUE, @@ -1579,8 +1582,11 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value) return; } shProg->Geom.VerticesOut = value; - break; + return; case GL_GEOMETRY_INPUT_TYPE_ARB: + if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4) + break; + switch (value) { case GL_POINTS: case GL_LINES: @@ -1595,8 +1601,11 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value) _mesa_lookup_enum_by_nr(value)); return; } - break; + return; case GL_GEOMETRY_OUTPUT_TYPE_ARB: + if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4) + break; + switch (value) { case GL_POINTS: case GL_LINE_STRIP: @@ -1609,12 +1618,13 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value) _mesa_lookup_enum_by_nr(value)); return; } - break; + return; default: - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameteri(pname=%s)", - _mesa_lookup_enum_by_nr(pname)); break; } + + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameteri(pname=%s)", + _mesa_lookup_enum_by_nr(pname)); } void -- 2.30.2