mirror of
https://github.com/brl/mutter.git
synced 2024-11-10 07:56:14 -05:00
cogl-context: Get rid of the features_cached member
The features_cached member of CoglContext is intended to mark when we've calculated the features so that we know if they are ready in cogl_get_features. However we always intialize the features while creating the context so features_cached will never be FALSE so it's not useful. We also had the odd behaviour that the COGL_DEBUG feature overrides were only applied in the first call to cogl_get_features. However there are other functions that use the feature flags such as cogl_features_available that don't use this function so in some cases the feature flags will be interpreted before the overrides are applied. This patch makes it always initialize the features and apply the overrides immediately while creating the context. This fixes a problem with COGL_DEBUG=disable-arbfp where the first material flushed is done before any call to cogl_get_features so it may still use ARBfp.
This commit is contained in:
parent
bbf912b61d
commit
7474d320f6
@ -58,6 +58,28 @@ _cogl_destroy_context_winsys (CoglContext *context);
|
||||
static CoglContext *_context = NULL;
|
||||
static gboolean gl_is_indirect = FALSE;
|
||||
|
||||
static void
|
||||
_cogl_init_feature_overrides (CoglContext *ctx)
|
||||
{
|
||||
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_VBOS))
|
||||
ctx->feature_flags &= ~COGL_FEATURE_VBOS;
|
||||
|
||||
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_PBOS))
|
||||
ctx->feature_flags &= ~COGL_FEATURE_PBOS;
|
||||
|
||||
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_ARBFP))
|
||||
ctx->feature_flags &= ~COGL_FEATURE_SHADERS_ARBFP;
|
||||
|
||||
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_GLSL))
|
||||
ctx->feature_flags &= ~COGL_FEATURE_SHADERS_GLSL;
|
||||
|
||||
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_NPOT_TEXTURES))
|
||||
ctx->feature_flags &= ~(COGL_FEATURE_TEXTURE_NPOT |
|
||||
COGL_FEATURE_TEXTURE_NPOT_BASIC |
|
||||
COGL_FEATURE_TEXTURE_NPOT_MIPMAP |
|
||||
COGL_FEATURE_TEXTURE_NPOT_REPEAT);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
cogl_create_context (void)
|
||||
{
|
||||
@ -91,7 +113,6 @@ cogl_create_context (void)
|
||||
/* Init default values */
|
||||
_context->feature_flags = 0;
|
||||
_context->feature_flags_private = 0;
|
||||
_context->features_cached = FALSE;
|
||||
|
||||
_context->texture_types = NULL;
|
||||
_context->buffer_types = NULL;
|
||||
@ -100,6 +121,7 @@ cogl_create_context (void)
|
||||
/* TODO: combine these two into one function */
|
||||
_cogl_create_context_driver (_context);
|
||||
_cogl_features_init ();
|
||||
_cogl_init_feature_overrides (_context);
|
||||
|
||||
_cogl_create_context_winsys (_context);
|
||||
|
||||
|
@ -55,7 +55,6 @@ typedef struct
|
||||
/* Features cache */
|
||||
CoglFeatureFlags feature_flags;
|
||||
CoglFeatureFlagsPrivate feature_flags_private;
|
||||
gboolean features_cached;
|
||||
|
||||
CoglHandle default_pipeline;
|
||||
CoglHandle default_layer_0;
|
||||
|
24
cogl/cogl.c
24
cogl/cogl.c
@ -432,24 +432,6 @@ cogl_get_features (void)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, 0);
|
||||
|
||||
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_VBOS))
|
||||
ctx->feature_flags &= ~COGL_FEATURE_VBOS;
|
||||
|
||||
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_PBOS))
|
||||
ctx->feature_flags &= ~COGL_FEATURE_PBOS;
|
||||
|
||||
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_ARBFP))
|
||||
ctx->feature_flags &= ~COGL_FEATURE_SHADERS_ARBFP;
|
||||
|
||||
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_GLSL))
|
||||
ctx->feature_flags &= ~COGL_FEATURE_SHADERS_GLSL;
|
||||
|
||||
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_NPOT_TEXTURES))
|
||||
ctx->feature_flags &= ~(COGL_FEATURE_TEXTURE_NPOT |
|
||||
COGL_FEATURE_TEXTURE_NPOT_BASIC |
|
||||
COGL_FEATURE_TEXTURE_NPOT_MIPMAP |
|
||||
COGL_FEATURE_TEXTURE_NPOT_REPEAT);
|
||||
|
||||
return ctx->feature_flags;
|
||||
}
|
||||
|
||||
@ -458,9 +440,6 @@ cogl_features_available (CoglFeatureFlags features)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, 0);
|
||||
|
||||
if (!ctx->features_cached)
|
||||
_cogl_features_init ();
|
||||
|
||||
return (ctx->feature_flags & features) == features;
|
||||
}
|
||||
|
||||
@ -469,9 +448,6 @@ _cogl_features_available_private (CoglFeatureFlagsPrivate features)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, 0);
|
||||
|
||||
if (!ctx->features_cached)
|
||||
_cogl_features_init ();
|
||||
|
||||
return (ctx->feature_flags_private & features) == features;
|
||||
}
|
||||
|
||||
|
@ -233,5 +233,4 @@ _cogl_features_init (void)
|
||||
/* Cache features */
|
||||
ctx->feature_flags = flags;
|
||||
ctx->feature_flags_private = flags_private;
|
||||
ctx->features_cached = TRUE;
|
||||
}
|
||||
|
@ -117,6 +117,5 @@ _cogl_features_init (void)
|
||||
|
||||
/* Cache features */
|
||||
ctx->feature_flags = flags;
|
||||
ctx->features_cached = TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user