[Mesa-dev] [PATCH 6/6] mesa/es3.1: Fix error code for glCreateShaderProgram
Matt Turner
mattst88 at gmail.com
Tue Jun 23 13:36:10 PDT 2015
On Tue, Jun 23, 2015 at 5:23 AM, Marta Lofstedt
<marta.lofstedt at linux.intel.com> wrote:
> From: Marta Lofstedt <marta.lofstedt at intel.com>
>
> According to the OpenGL ES standard, 7.3.
> For a call to glCreateShaderProgram with count < 0,
> a GL_INVALID_VALUE error should be generated.
>
> Signed-off-by: Marta Lofstedt <marta.lofstedt at linux.intel.com>
> ---
> src/mesa/main/shaderapi.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
> index c783c69..266064d 100644
> --- a/src/mesa/main/shaderapi.c
> +++ b/src/mesa/main/shaderapi.c
> @@ -1890,6 +1890,15 @@ _mesa_create_shader_program(struct gl_context* ctx, GLboolean separate,
> const GLuint shader = create_shader(ctx, type);
> GLuint program = 0;
>
> + /*
> + * According to OpenGL ES 3.1 standard 7.3: GL_INVALID_VALUE
> + * should be generated, if count < 0.
> + */
The format of spec citations is
/* Page 65 in section 7.3 Program Objects of the OpenGL ES 3.1 spec says:
*
* "An INVALID_VALUE error is generated if count is negative."
*
* "If an error is generated, zero is returned."
*/
> + if (_mesa_is_gles31(ctx) && count < 0) {
glCreateShaderProgramv comes from ARB_separate_shader_objects (merged
in GL 4.1), and in GL 4.3 the spec gained the new text cited above. I
think we should take that change as a clarification (a change that
should apply to previous versions retroactively) instead of an actual
change in behavior. As such, I think we should remove the
_mesa_is_gles31 check. I'd modify the citation to mention GL 4.3 as
well.
> + _mesa_error(ctx, GL_INVALID_VALUE, "glCreateShaderProgram (count < 0)");
Missing the "v" at the end of "glCreateShaderProgramv"
> + return program;
Just return literal 0 here to make it more clear.
More information about the mesa-dev
mailing list