[Mesa-dev] [PATCH] mesa: Rearrange array type checking, filter more types in ES

Brian Paul brianp at vmware.com
Fri Aug 24 08:47:07 PDT 2012


On 08/24/2012 09:37 AM, Ian Romanick wrote:
> From: Ian Romanick<ian.d.romanick at intel.com>
>
> v2: Fix handling of GL_INT and GL_UNSIGNED_INT types pre-ES3.0, and fix
> handling of GL_INT_2_10_10_10_REV and GL_UNSIGNED_INT_2_10_10_10_REV in
> ES3.0.  Based on review comments by Ken Graunke.
>
> Signed-off-by: Ian Romanick<ian.d.romanick at intel.com>
> ---
>   src/mesa/main/varray.c |   34 +++++++++++++++++++++++++---------
>   1 files changed, 25 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index 327fabb..54fe073 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -133,16 +133,32 @@ update_array(struct gl_context *ctx,
>      GLsizei elementSize;
>      GLenum format = GL_RGBA;
>
> -   if (ctx->API != API_OPENGLES&&  ctx->API != API_OPENGLES2) {
> -      /* fixed point arrays / data is only allowed with OpenGL ES 1.x/2.0 */
> +   if (_mesa_is_gles(ctx)) {
> +      /* Once Mesa gets support for GL_OES_vertex_half_float this mask will
> +       * change.  Adding support for this extension isn't quite as trivial as
> +       * we'd like because ES uses a different enum value for GL_HALF_FLOAT.
> +       */
> +      legalTypesMask&= ~(FIXED_GL_BIT | HALF_BIT | DOUBLE_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
> +       * GL_OES_vertex_type_10_10_10_2.
> +       */
> +      if (ctx->Version<  30) {
> +         legalTypesMask&= ~(UNSIGNED_INT_BIT
> +                             | INT_BIT
> +                             | UNSIGNED_INT_2_10_10_10_REV_BIT
> +                             | INT_2_10_10_10_REV_BIT);
> +      }
> +   } else {
>         legalTypesMask&= ~FIXED_ES_BIT;
> -   }
> -   if (!ctx->Extensions.ARB_ES2_compatibility) {
> -      legalTypesMask&= ~FIXED_GL_BIT;
> -   }
> -   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_ES2_compatibility)
> +         legalTypesMask&= ~FIXED_GL_BIT;
> +
> +      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);
>      }
>
>      typeBit = type_to_bit(ctx, type);

LGTM, but a third set of eyes would probably be good.

Reviewed-by: Brian Paul <brianp at vmware.com>


BTW, while looking at varray.c I spotted a small simplification at 
line 150:

  if (typeBit == 0x0 || (typeBit & legalTypesMask) == 0x0) {

could just be:

  if ((typeBit & legalTypesMask) == 0x0) {

-Brian


More information about the mesa-dev mailing list