[Mesa-dev] [PATCH 2/7] mesa: add varray support for UNSIGNED_INT_10F_11F_11F_REV type

Eric Anholt eric at anholt.net
Thu Nov 7 11:22:44 PST 2013


Chris Forbes <chrisf at ijw.co.nz> writes:

> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>  src/mesa/main/varray.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index dee476a..5af4c8c 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -60,6 +60,7 @@
>  #define FIXED_GL_BIT         0x800
>  #define UNSIGNED_INT_2_10_10_10_REV_BIT 0x1000
>  #define INT_2_10_10_10_REV_BIT 0x2000
> +#define UNSIGNED_INT_10F_11F_11F_REV_BIT 0x4000
>  
>  
>  /** Convert GL datatype enum into a <type>_BIT value seen above */
> @@ -96,6 +97,8 @@ type_to_bit(const struct gl_context *ctx, GLenum type)
>        return UNSIGNED_INT_2_10_10_10_REV_BIT;
>     case GL_INT_2_10_10_10_REV:
>        return INT_2_10_10_10_REV_BIT;
> +   case GL_UNSIGNED_INT_10F_11F_11F_REV:
> +      return UNSIGNED_INT_10F_11F_11F_REV_BIT;
>     default:
>        return 0;
>     }
> @@ -150,7 +153,7 @@ update_array(struct gl_context *ctx,
>     }
>  
>     if (_mesa_is_gles(ctx)) {
> -      legalTypesMask &= ~(FIXED_GL_BIT | DOUBLE_BIT);
> +      legalTypesMask &= ~(FIXED_GL_BIT | DOUBLE_BIT | UNSIGNED_INT_10F_11F_11F_REV_BIT);
>  
>        /* GL_INT and GL_UNSIGNED_INT data is not allowed in OpenGL ES until
>         * 3.0.  The 2_10_10_10 types are added in OpenGL ES 3.0 or
> @@ -180,6 +183,9 @@ update_array(struct gl_context *ctx,
>        if (!ctx->Extensions.ARB_vertex_type_2_10_10_10_rev)
>           legalTypesMask &= ~(UNSIGNED_INT_2_10_10_10_REV_BIT |
>                               INT_2_10_10_10_REV_BIT);
> +
> +      if (!ctx->Extensions.ARB_vertex_type_10f_11f_11f_rev)
> +         legalTypesMask &= ~UNSIGNED_INT_10F_11F_11F_REV_BIT;
>     }
>  
>     typeBit = type_to_bit(ctx, type);
> @@ -243,6 +249,12 @@ update_array(struct gl_context *ctx,
>        return;
>     }
>  
> +   if (ctx->Extensions.ARB_vertex_type_10f_11f_11f_rev &&
> +         type == GL_UNSIGNED_INT_10F_11F_11F_REV && size != 3) {
> +      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(size=%d)", func, size);
> +      return;
> +   }
> +

This extension availability check seems silly, since we've already
checked that the context supports the format in legalTypesMask.  But it
follows the surrounding style, so I guess it's fine.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131107/2ec6291e/attachment.pgp>


More information about the mesa-dev mailing list