[Mesa-dev] [PATCH] mesa: Update the BGRA vertex array error handling

Brian Paul brianp at vmware.com
Thu Apr 25 16:34:32 PDT 2013


On 04/25/2013 04:44 PM, Fredrik Höglund wrote:
> The error code was changed from INVALID_VALUE to INVALID_OPERATION
> in OpenGL 3.3. We should also generate an error when size is BGRA
> and normalized is FALSE.
> ---
>
> Note that this makes glean/tvertarraybgra fail because it expects
> the error to be INVALID_VALUE.  I'll send a patch for that to
> the piglit list.

Even better, maybe convert that test to be a native piglit test.  It's 
not too complicated.


>
>   src/mesa/main/varray.c |   19 ++++++++++++++++++-
>   1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index 4f6d96c..c0f8c17 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -197,6 +197,16 @@ update_array(struct gl_context *ctx,
>      if (ctx->Extensions.EXT_vertex_array_bgra&&
>          sizeMax == BGRA_OR_4&&
>          size == GL_BGRA) {
> +      /* Page 298 of the PDF of the OpenGL 4.3 (Core Profile) spec says:
> +       *
> +       * "An INVALID_OPERATION error is generated under any of the following
> +       *  conditions:
> +       *    ...
> +       *    • size is BGRA and type is not UNSIGNED_BYTE, INT_2_10_10_10_REV
> +       *      or UNSIGNED_INT_2_10_10_10_REV;
> +       *    ...
> +       *    • size is BGRA and normalized is FALSE;"
> +       */
>         GLboolean bgra_error = GL_FALSE;
>
>         if (ctx->Extensions.ARB_vertex_type_2_10_10_10_rev) {
> @@ -208,9 +218,16 @@ update_array(struct gl_context *ctx,
>            bgra_error = GL_TRUE;
>
>         if (bgra_error) {
> -         _mesa_error(ctx, GL_INVALID_VALUE, "%s(GL_BGRA/GLubyte)", func);
> +         _mesa_error(ctx, GL_INVALID_OPERATION, "%s(size=GL_BGRA and type=%s)",
> +                     func, _mesa_lookup_enum_by_nr(type));

Maybe we should continue to raise INVALID_VALUE if ctx->Version <= 33? 
  Opinions?


>            return;
>         }
> +
> +      if (!normalized) {
> +         _mesa_error(ctx, GL_INVALID_OPERATION, "%s(size=GL_BGRA and normalized=GL_FALSE)", func);
> +         return;
> +      }
> +
>         format = GL_BGRA;
>         size = 4;
>      }



More information about the mesa-dev mailing list