[Mesa-dev] [PATCH] mesa: Reject VertexAttribPointer() with GL_BGRA and !normalized.

Fredrik Höglund fredrik at kde.org
Mon Jul 15 06:37:49 PDT 2013


On Monday 15 July 2013, Kenneth Graunke wrote:
> Fixes Piglit's ARB_vertex_attrib_bgra/api-errors test.
> 
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/main/varray.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index 529d933..48f15bd 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -463,6 +463,16 @@ _mesa_VertexAttribPointer(GLuint index, GLint size, GLenum type,
>        return;
>     }
>  
> +   /* From the GL_ARB_vertex_array_bgra specification:
> +    * "The error INVALID_VALUE is generated by VertexAttribPointer if
> +    *  size is BGRA and normalized is FALSE."
> +    */
> +   if (size == GL_BGRA && !normalized) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "glVertexAttribPointer(BGRA and !normalized)");
> +      return;
> +   }
> +

I think this code belongs in update_array(), since it already handles other
BGRA errors, and also checks if the extension is supported.

This also reminds me that we need to decide if we should make the error
code depend on the GL version and entry point.

Both OpenGL 3.3 and GL_ARB_vertex_attrib_binding changes the error code
to GL_INVALID_OPERATION. The extension only does it for the entry points
it adds.

I personally don't think it's worth adding the additional complexity for
that since the conditions under which the errors to be generated haven't
changed.

Fredrik



More information about the mesa-dev mailing list