From: Brian Paul Date: Fri, 2 Jan 2015 23:56:12 +0000 (-0700) Subject: mesa: rearrange error handling in glProgramParameteri() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5b7e7cfb2b15e787e13abc8506cee9e731257902;p=mesa.git mesa: rearrange error handling in glProgramParameteri() Reviewed-by: Eric Anholt --- diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index b7c39ee195c..8e49e3010c4 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -1755,12 +1755,7 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value) * ProgramParameteri is not TRUE or FALSE." */ if (value != GL_TRUE && value != GL_FALSE) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glProgramParameteri(pname=%s, value=%d): " - "value must be 0 or 1.", - _mesa_lookup_enum_by_nr(pname), - value); - return; + goto invalid_value; } /* No need to notify the driver. Any changes will actually take effect @@ -1791,22 +1786,23 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value) * Chapter 7.3 Program Objects */ if (value != GL_TRUE && value != GL_FALSE) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glProgramParameteri(pname=%s, value=%d): " - "value must be 0 or 1.", - _mesa_lookup_enum_by_nr(pname), - value); - return; + goto invalid_value; } shProg->SeparateShader = value; return; default: - break; + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameteri(pname=%s)", + _mesa_lookup_enum_by_nr(pname)); + return; } - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameteri(pname=%s)", - _mesa_lookup_enum_by_nr(pname)); +invalid_value: + _mesa_error(ctx, GL_INVALID_VALUE, + "glProgramParameteri(pname=%s, value=%d): " + "value must be 0 or 1.", + _mesa_lookup_enum_by_nr(pname), + value); } void