From 10daade1c076436141f8eaff109d3c601fc34b03 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 22 Oct 2019 15:13:44 -0400 Subject: [PATCH] cogl: Remove COGL_PRIVATE_FEATURE_GL_FIXED, track it in the driver At this point only the gl driver is at all aware of the difference between core and compat contexts. COGL_PRIVATE_FEATURE_GL_FIXED is also now quite misnamed, since we're using the GLSL pipeline even for pre-GL3 contexts. Remove the private feature and handle the few remaining differences by checking the driver class inside the gl driver. https://gitlab.gnome.org/GNOME/mutter/merge_requests/973 --- cogl/cogl/cogl-private.h | 1 - cogl/cogl/cogl-renderer.c | 1 - cogl/cogl/driver/gl/cogl-attribute-gl.c | 6 ++---- cogl/cogl/driver/gl/cogl-pipeline-opengl.c | 7 +++---- cogl/cogl/driver/gl/gl/cogl-driver-gl.c | 3 +-- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/cogl/cogl/cogl-private.h b/cogl/cogl/cogl-private.h index a4b53ef7a..bc2a95409 100644 --- a/cogl/cogl/cogl-private.h +++ b/cogl/cogl/cogl-private.h @@ -68,7 +68,6 @@ typedef enum * driver being used and instead check for broad opengl feature * sets that can be shared by several GL apis */ COGL_PRIVATE_FEATURE_ANY_GL, - COGL_PRIVATE_FEATURE_GL_FIXED, COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, COGL_PRIVATE_FEATURE_GL_EMBEDDED, COGL_PRIVATE_FEATURE_GL_WEB, diff --git a/cogl/cogl/cogl-renderer.c b/cogl/cogl/cogl-renderer.c index f77a26317..1463aa842 100644 --- a/cogl/cogl/cogl-renderer.c +++ b/cogl/cogl/cogl-renderer.c @@ -91,7 +91,6 @@ static CoglDriverDescription _cogl_drivers[] = COGL_DRIVER_GL, "gl", { COGL_PRIVATE_FEATURE_ANY_GL, - COGL_PRIVATE_FEATURE_GL_FIXED, COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, -1 }, &_cogl_driver_gl, diff --git a/cogl/cogl/driver/gl/cogl-attribute-gl.c b/cogl/cogl/driver/gl/cogl-attribute-gl.c index a29ea82b9..30a6cd6ea 100644 --- a/cogl/cogl/driver/gl/cogl-attribute-gl.c +++ b/cogl/cogl/driver/gl/cogl-attribute-gl.c @@ -59,8 +59,7 @@ toggle_builtin_attribute_enabled_cb (int bit_num, void *user_data) ForeachChangedBitState *state = user_data; CoglContext *context = state->context; - g_return_val_if_fail (_cogl_has_private_feature - (context, COGL_PRIVATE_FEATURE_GL_FIXED), + g_return_val_if_fail (context->driver == COGL_DRIVER_GL, FALSE); #ifdef HAVE_COGL_GL @@ -98,8 +97,7 @@ toggle_texcood_attribute_enabled_cb (int bit_num, void *user_data) ForeachChangedBitState *state = user_data; CoglContext *context = state->context; - g_return_val_if_fail (_cogl_has_private_feature - (context, COGL_PRIVATE_FEATURE_GL_FIXED), + g_return_val_if_fail (context->driver == COGL_DRIVER_GL, FALSE); #ifdef HAVE_COGL_GL diff --git a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c index 07cf2eb47..f4baac312 100644 --- a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c +++ b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c @@ -360,8 +360,7 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state ( _COGL_GET_CONTEXT (ctx, NO_RETVAL); /* On GLES2 we'll flush the color later */ - if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED) && - !with_color_attrib) + if (ctx->driver == COGL_DRIVER_GL && !with_color_attrib) { if ((pipelines_difference & COGL_PIPELINE_STATE_COLOR) || /* Assume if we were previously told to skip the color, then @@ -563,7 +562,7 @@ get_max_activateable_texture_units (void) #endif #ifdef HAVE_COGL_GL - if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED)) + if (ctx->driver == COGL_DRIVER_GL) { /* GL_MAX_TEXTURE_UNITS defines the number of units that are usable from the fixed function pipeline, therefore it isn't @@ -695,7 +694,7 @@ flush_layers_common_gl_state_cb (CoglPipelineLayer *layer, void *user_data) * glsl progend. */ #ifdef HAVE_COGL_GL - if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED) && + if (ctx->driver == COGL_DRIVER_GL && (layers_difference & COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS)) { CoglPipelineState change = COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS; diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c index a9fdee0a4..534631708 100644 --- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c +++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c @@ -86,7 +86,7 @@ _cogl_driver_gl_context_init (CoglContext *context, pipeline to track whether any layers have point sprite coords enabled. We don't need to do this for GL3 or GLES2 because point sprites are handled using a builtin varying in the shader. */ - if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_GL_FIXED)) + if (context->driver == COGL_DRIVER_GL) GE (context, glEnable (GL_POINT_SPRITE)); return TRUE; @@ -504,7 +504,6 @@ _cogl_driver_update_features (CoglContext *ctx, if (ctx->driver == COGL_DRIVER_GL) { /* Features which are not available in GL 3 */ - COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_GL_FIXED, TRUE); COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEST, TRUE); COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, TRUE);