[Mesa-dev] [PATCH 1/3] mesa: Simplify some tests in update_array_format()

Ian Romanick idr at freedesktop.org
Thu Mar 5 14:56:49 PST 2015


On 03/05/2015 10:56 AM, Fredrik Höglund wrote:
> There is no need to check if these extensions are supported here;
> if the data type is not supported, we will already have returned a
> GL_INVALID_ENUM error.

>From where would GL_INVALID_ENUM have been generated?  Is that the
"(typeBit & legalTypesMask) == 0x0" check?

Do we have any piglit tests that verify this?  We'd have to find some
driver that doesn't support these extensions to try it...

> ---
>  src/mesa/main/varray.c | 20 +++++---------------
>  1 file changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index 42e7f89..efc1431 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -301,17 +301,9 @@ update_array_format(struct gl_context *ctx,
>         *    ...
>         *    • size is BGRA and normalized is FALSE;"
>         */
> -      bool bgra_error = false;
> -
> -      if (ctx->Extensions.ARB_vertex_type_2_10_10_10_rev) {
> -         if (type != GL_UNSIGNED_INT_2_10_10_10_REV &&
> -             type != GL_INT_2_10_10_10_REV &&
> -             type != GL_UNSIGNED_BYTE)
> -            bgra_error = true;
> -      } else if (type != GL_UNSIGNED_BYTE)
> -         bgra_error = true;
> -
> -      if (bgra_error) {
> +      if (type != GL_UNSIGNED_INT_2_10_10_10_REV &&
> +          type != GL_INT_2_10_10_10_REV &&
> +          type != GL_UNSIGNED_BYTE) {
>           _mesa_error(ctx, GL_INVALID_OPERATION, "%s(size=GL_BGRA and type=%s)",
>                       func, _mesa_lookup_enum_by_nr(type));
>           return false;
> @@ -331,8 +323,7 @@ update_array_format(struct gl_context *ctx,
>        return false;
>     }
>  
> -   if (ctx->Extensions.ARB_vertex_type_2_10_10_10_rev &&
> -       (type == GL_UNSIGNED_INT_2_10_10_10_REV ||
> +   if ((type == GL_UNSIGNED_INT_2_10_10_10_REV ||
>          type == GL_INT_2_10_10_10_REV) && size != 4) {
>        _mesa_error(ctx, GL_INVALID_OPERATION, "%s(size=%d)", func, size);
>        return false;
> @@ -351,8 +342,7 @@ update_array_format(struct gl_context *ctx,
>        return false;
>     }
>  
> -   if (ctx->Extensions.ARB_vertex_type_10f_11f_11f_rev &&
> -         type == GL_UNSIGNED_INT_10F_11F_11F_REV && size != 3) {
> +   if (type == GL_UNSIGNED_INT_10F_11F_11F_REV && size != 3) {
>        _mesa_error(ctx, GL_INVALID_OPERATION, "%s(size=%d)", func, size);
>        return false;
>     }



More information about the mesa-dev mailing list