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.
*
* These are or'd with gl_context::NewDriverState to notify a driver about
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;