summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2014-12-02 12:10:14 +0100
committerIago Toral Quiroga <[email protected]>2014-12-09 11:40:00 +0100
commite1ed4f2532b4e9bafb5663cccbe28033c49b2e77 (patch)
tree227a075cbbdeae526d87d55499ff66a2cbe6a7cf /src/mesa
parent09cb149ba745302e366c2f965a033103d398748c (diff)
mesa: Recompute LegalTypesMask if the GL API has changed
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 <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/mtypes.h32
-rw-r--r--src/mesa/main/varray.c9
2 files changed, 22 insertions, 19 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index cee11a39120..b95dfb9f7b7 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1657,6 +1657,20 @@ typedef enum {
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
@@ -1701,8 +1715,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;
+ gl_api LegalTypesMaskAPI;
};
@@ -4040,21 +4055,6 @@ enum mesa_debug_severity {
/** @} */
/**
- * 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.
*
* These are or'd with gl_context::NewDriverState to notify a driver about
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 96c2b26f7a9..89aaad1aabd 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -258,11 +258,14 @@ update_array_format(struct gl_context *ctx,
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;