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}
Reviewed-by: Brian Paul <brianp@vmware.com>
DRAW_ARRAYS
} gl_draw_method;
+/**
+ * Enum for the OpenGL APIs we know about and may support.
+ *
+ * NOTE: This must match the api_enum table in
+ * src/mesa/main/get_hash_generator.py
+ */
+typedef enum
+{
+ API_OPENGL_COMPAT, /* legacy / compatibility contexts */
+ API_OPENGLES,
+ API_OPENGLES2,
+ API_OPENGL_CORE,
+ API_OPENGL_LAST = API_OPENGL_CORE
+} gl_api;
/**
* Vertex array state
/** 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;
+ gl_api LegalTypesMaskAPI;
};
/** @} */
-/**
- * Enum for the OpenGL APIs we know about and may support.
- *
- * NOTE: This must match the api_enum table in
- * src/mesa/main/get_hash_generator.py
- */
-typedef enum
-{
- API_OPENGL_COMPAT, /* legacy / compatibility contexts */
- API_OPENGLES,
- API_OPENGLES2,
- API_OPENGL_CORE,
- API_OPENGL_LAST = API_OPENGL_CORE
-} gl_api;
-
/**
* Driver-specific state flags.
*
GLuint elementSize;
GLenum format = GL_RGBA;
- if (ctx->Array.LegalTypesMask == 0) {
- /* One-time initialization. We can't do this in _mesa_init_varrays()
- * below because extensions are not yet enabled at that point.
+ if (ctx->Array.LegalTypesMask == 0 || ctx->Array.LegalTypesMaskAPI != ctx->API) {
+ /* Compute the LegalTypesMask only once, unless the context API has
+ * changed, in which case we want to compute it again. We can't do this
+ * in _mesa_init_varrays() below because extensions are not yet enabled
+ * at that point.
*/
ctx->Array.LegalTypesMask = get_legal_types_mask(ctx);
+ ctx->Array.LegalTypesMaskAPI = ctx->API;
}
legalTypesMask &= ctx->Array.LegalTypesMask;