[Mesa-dev] [PATCH 04/10] mesa: Recompute LegalTypesMask if the GL API has changed

Brian Paul brianp at vmware.com
Mon Dec 1 08:24:39 PST 2014


On 12/01/2014 06:04 AM, Eduardo Lima Mitev wrote:
> From: Iago Toral Quiroga <itoral at igalia.com>
>
> The current code computes ctx->Array.LegalTypesMask just once,
> however, computing this needs to consider ctx->API so we need
> to make sure that the API for that context has not changed if
> we intend to reuse the result.
>
> The context API can change, at least, if we go through
> _mesa_meta_begin, since that will always force
> API_OPENGL_COMPAT until we call _mesa_meta_end. If any
> operation in between these two calls triggers a call to
> update_array_format, then we might be caching a value for
> LegalTypesMask that will not be right once we have called
> _mesa_meta_end and restored the context API.
>
> Fixes the following 179 dEQP tests in i965:
> dEQP-GLES3.functional.vertex_arrays.single_attribute.strides.fixed.*
> dEQP-GLES3.functional.vertex_arrays.single_attribute.normalize.fixed.*
> dEQP-GLES3.functional.vertex_arrays.single_attribute.output_types.fixed.*
> dEQP-GLES3.functional.vertex_arrays.single_attribute.usages.static_draw.*fixed*
> dEQP-GLES3.functional.vertex_arrays.single_attribute.usages.stream_draw.*fixed*
> dEQP-GLES3.functional.vertex_arrays.single_attribute.usages.dynamic_draw.*fixed*
> dEQP-GLES3.functional.vertex_arrays.single_attribute.usages.static_copy.*fixed*
> dEQP-GLES3.functional.vertex_arrays.single_attribute.usages.stream_copy.*fixed*
> dEQP-GLES3.functional.vertex_arrays.single_attribute.usages.dynamic_copy.*fixed*
> dEQP-GLES3.functional.vertex_arrays.single_attribute.usages.static_read.*fixed*
> dEQP-GLES3.functional.vertex_arrays.single_attribute.usages.stream_read.*fixed*
> dEQP-GLES3.functional.vertex_arrays.single_attribute.usages.dynamic_read.*fixed*
> dEQP-GLES3.functional.vertex_arrays.multiple_attributes.input_types.3_*fixed2*
> dEQP-GLES3.functional.draw.random.{2,18,28,68,83,106,109,156,181,191}
> ---
>   src/mesa/main/mtypes.h | 3 ++-
>   src/mesa/main/varray.c | 3 ++-
>   2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 7389baa..78f034d 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -1701,8 +1701,9 @@ struct gl_array_attrib
>      /** One of the DRAW_xxx flags, not consumed by drivers */
>      gl_draw_method DrawMethod;
>
> -   /** Legal array datatypes */
> +   /** Legal array datatypes and the API for which they have been computed */
>      GLbitfield LegalTypesMask;
> +   int LegalTypesMaskAPI;

gl_api LegalTypesMaskAPI;


>   };
>
>
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index 96c2b26..acfc4bd 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -258,11 +258,12 @@ update_array_format(struct gl_context *ctx,
>      GLuint elementSize;
>      GLenum format = GL_RGBA;
>
> -   if (ctx->Array.LegalTypesMask == 0) {
> +   if (ctx->Array.LegalTypesMask == 0 || ctx->Array.LegalTypesMaskAPI != ctx->API) {
>         /* One-time initialization.  We can't do this in _mesa_init_varrays()
>          * below because extensions are not yet enabled at that point.
>          */

Should probably update the comment to say something like:

"Compute the LegalTypesMask if it's uninitialized or the context API 
changes."


>         ctx->Array.LegalTypesMask = get_legal_types_mask(ctx);
> +      ctx->Array.LegalTypesMaskAPI = ctx->API;
>      }
>
>      legalTypesMask &= ctx->Array.LegalTypesMask;
>



More information about the mesa-dev mailing list