diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/mtypes.h | 32 | ||||
-rw-r--r-- | src/mesa/main/varray.c | 9 |
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; |