diff --git a/clutter/cogl/cogl/cogl-context.c b/clutter/cogl/cogl/cogl-context.c index 37965d119..fa8a4b1bd 100644 --- a/clutter/cogl/cogl/cogl-context.c +++ b/clutter/cogl/cogl/cogl-context.c @@ -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); diff --git a/clutter/cogl/cogl/cogl-context.h b/clutter/cogl/cogl/cogl-context.h index b3784d51b..0bc0248d4 100644 --- a/clutter/cogl/cogl/cogl-context.h +++ b/clutter/cogl/cogl/cogl-context.h @@ -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; diff --git a/clutter/cogl/cogl/cogl.c b/clutter/cogl/cogl/cogl.c index ce8326955..5df6e93dc 100644 --- a/clutter/cogl/cogl/cogl.c +++ b/clutter/cogl/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; } diff --git a/clutter/cogl/cogl/driver/gl/cogl-gl.c b/clutter/cogl/cogl/driver/gl/cogl-gl.c index a8494fe0b..b0b069f8c 100644 --- a/clutter/cogl/cogl/driver/gl/cogl-gl.c +++ b/clutter/cogl/cogl/driver/gl/cogl-gl.c @@ -233,5 +233,4 @@ _cogl_features_init (void) /* Cache features */ ctx->feature_flags = flags; ctx->feature_flags_private = flags_private; - ctx->features_cached = TRUE; } diff --git a/clutter/cogl/cogl/driver/gles/cogl-gles.c b/clutter/cogl/cogl/driver/gles/cogl-gles.c index c268f614f..1f9c9e081 100644 --- a/clutter/cogl/cogl/driver/gles/cogl-gles.c +++ b/clutter/cogl/cogl/driver/gles/cogl-gles.c @@ -117,6 +117,5 @@ _cogl_features_init (void) /* Cache features */ ctx->feature_flags = flags; - ctx->features_cached = TRUE; }