[Mesa-dev] [PATCH v2] mesa: Raise INVALID_VALUE from glCreateShaderProgramv if count < 0

Timothy Arceri t_arceri at yahoo.com.au
Thu Aug 13 06:23:30 PDT 2015


On Thu, 2015-08-13 at 14:38 +0200, Marta Lofstedt wrote:
> From: Marta Lofstedt <marta.lofstedt at intel.com>
> 
> According to OpenGL version 4.5 and OpenGL ES 3.1 standards,
> section 7.3:
> GL_INVALID_VALUE should be generated, if count is less than 0.
> 
> V2: Changed title, eased Open GL ES 3.1 restriction
> and added comments.
> ---
>  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 f9a7d13..1622274 100644
> --- a/src/mesa/main/shaderapi.c
> +++ b/src/mesa/main/shaderapi.c
> @@ -2003,6 +2003,15 @@ _mesa_create_shader_program(struct gl_context* ctx, 
> GLboolean separate,
>     const GLuint shader = create_shader(ctx, type);
>     GLuint program = 0;
>  
> +   /*
> +    * According to OpenGL 4.5 and OpenGL ES 3.1 standards, section 7.3:
> +    * GL_INVALID_VALUE should be generated if count < 0
> +    */
> +   if (count < 0) {
> +      _mesa_error(ctx, GL_INVALID_VALUE, "glCreateShaderProgram (count < 
> 0)");
> +      return program;
> +   }
> +

It looks like this should be checked in ShaderSource() but it doesn't hurt
much to check here too since this shouldn't be called too often. Did you want
to add it to ShaderSource() in a follow up patch?

For this patch: Reviewed-by: Timothy Arceri <t_arceri at yahoo.com.au>

>     if (shader) {
>        _mesa_ShaderSource(shader, count, strings, NULL);
>  


More information about the mesa-dev mailing list