mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00: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
b9176e8672
commit
1b2a748d6c
@ -58,6 +58,28 @@ _cogl_destroy_context_winsys (CoglContext *context);
|
|||||||
static CoglContext *_context = NULL;
|
static CoglContext *_context = NULL;
|
||||||
static gboolean gl_is_indirect = FALSE;
|
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
|
static gboolean
|
||||||
cogl_create_context (void)
|
cogl_create_context (void)
|
||||||
{
|
{
|
||||||
@ -91,7 +113,6 @@ cogl_create_context (void)
|
|||||||
/* Init default values */
|
/* Init default values */
|
||||||
_context->feature_flags = 0;
|
_context->feature_flags = 0;
|
||||||
_context->feature_flags_private = 0;
|
_context->feature_flags_private = 0;
|
||||||
_context->features_cached = FALSE;
|
|
||||||
|
|
||||||
_context->texture_types = NULL;
|
_context->texture_types = NULL;
|
||||||
_context->buffer_types = NULL;
|
_context->buffer_types = NULL;
|
||||||
@ -100,6 +121,7 @@ cogl_create_context (void)
|
|||||||
/* TODO: combine these two into one function */
|
/* TODO: combine these two into one function */
|
||||||
_cogl_create_context_driver (_context);
|
_cogl_create_context_driver (_context);
|
||||||
_cogl_features_init ();
|
_cogl_features_init ();
|
||||||
|
_cogl_init_feature_overrides (_context);
|
||||||
|
|
||||||
_cogl_create_context_winsys (_context);
|
_cogl_create_context_winsys (_context);
|
||||||
|
|
||||||
|
@ -55,7 +55,6 @@ typedef struct
|
|||||||
/* Features cache */
|
/* Features cache */
|
||||||
CoglFeatureFlags feature_flags;
|
CoglFeatureFlags feature_flags;
|
||||||
CoglFeatureFlagsPrivate feature_flags_private;
|
CoglFeatureFlagsPrivate feature_flags_private;
|
||||||
gboolean features_cached;
|
|
||||||
|
|
||||||
CoglHandle default_pipeline;
|
CoglHandle default_pipeline;
|
||||||
CoglHandle default_layer_0;
|
CoglHandle default_layer_0;
|
||||||
|
@ -432,24 +432,6 @@ cogl_get_features (void)
|
|||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, 0);
|
_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;
|
return ctx->feature_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,9 +440,6 @@ cogl_features_available (CoglFeatureFlags features)
|
|||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, 0);
|
_COGL_GET_CONTEXT (ctx, 0);
|
||||||
|
|
||||||
if (!ctx->features_cached)
|
|
||||||
_cogl_features_init ();
|
|
||||||
|
|
||||||
return (ctx->feature_flags & features) == features;
|
return (ctx->feature_flags & features) == features;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,9 +448,6 @@ _cogl_features_available_private (CoglFeatureFlagsPrivate features)
|
|||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, 0);
|
_COGL_GET_CONTEXT (ctx, 0);
|
||||||
|
|
||||||
if (!ctx->features_cached)
|
|
||||||
_cogl_features_init ();
|
|
||||||
|
|
||||||
return (ctx->feature_flags_private & features) == features;
|
return (ctx->feature_flags_private & features) == features;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,5 +233,4 @@ _cogl_features_init (void)
|
|||||||
/* Cache features */
|
/* Cache features */
|
||||||
ctx->feature_flags = flags;
|
ctx->feature_flags = flags;
|
||||||
ctx->feature_flags_private = flags_private;
|
ctx->feature_flags_private = flags_private;
|
||||||
ctx->features_cached = TRUE;
|
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,5 @@ _cogl_features_init (void)
|
|||||||
|
|
||||||
/* Cache features */
|
/* Cache features */
|
||||||
ctx->feature_flags = flags;
|
ctx->feature_flags = flags;
|
||||||
ctx->features_cached = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user