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
This commit is contained in:
Adam Jackson 2019-10-22 15:13:44 -04:00 committed by Georges Basile Stavracas Neto
parent 9a3a6dc212
commit 10daade1c0
5 changed files with 6 additions and 12 deletions

View File

@ -68,7 +68,6 @@ typedef enum
* driver being used and instead check for broad opengl feature * driver being used and instead check for broad opengl feature
* sets that can be shared by several GL apis */ * sets that can be shared by several GL apis */
COGL_PRIVATE_FEATURE_ANY_GL, COGL_PRIVATE_FEATURE_ANY_GL,
COGL_PRIVATE_FEATURE_GL_FIXED,
COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE,
COGL_PRIVATE_FEATURE_GL_EMBEDDED, COGL_PRIVATE_FEATURE_GL_EMBEDDED,
COGL_PRIVATE_FEATURE_GL_WEB, COGL_PRIVATE_FEATURE_GL_WEB,

View File

@ -91,7 +91,6 @@ static CoglDriverDescription _cogl_drivers[] =
COGL_DRIVER_GL, COGL_DRIVER_GL,
"gl", "gl",
{ COGL_PRIVATE_FEATURE_ANY_GL, { COGL_PRIVATE_FEATURE_ANY_GL,
COGL_PRIVATE_FEATURE_GL_FIXED,
COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE,
-1 }, -1 },
&_cogl_driver_gl, &_cogl_driver_gl,

View File

@ -59,8 +59,7 @@ toggle_builtin_attribute_enabled_cb (int bit_num, void *user_data)
ForeachChangedBitState *state = user_data; ForeachChangedBitState *state = user_data;
CoglContext *context = state->context; CoglContext *context = state->context;
g_return_val_if_fail (_cogl_has_private_feature g_return_val_if_fail (context->driver == COGL_DRIVER_GL,
(context, COGL_PRIVATE_FEATURE_GL_FIXED),
FALSE); FALSE);
#ifdef HAVE_COGL_GL #ifdef HAVE_COGL_GL
@ -98,8 +97,7 @@ toggle_texcood_attribute_enabled_cb (int bit_num, void *user_data)
ForeachChangedBitState *state = user_data; ForeachChangedBitState *state = user_data;
CoglContext *context = state->context; CoglContext *context = state->context;
g_return_val_if_fail (_cogl_has_private_feature g_return_val_if_fail (context->driver == COGL_DRIVER_GL,
(context, COGL_PRIVATE_FEATURE_GL_FIXED),
FALSE); FALSE);
#ifdef HAVE_COGL_GL #ifdef HAVE_COGL_GL

View File

@ -360,8 +360,7 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
/* On GLES2 we'll flush the color later */ /* On GLES2 we'll flush the color later */
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED) && if (ctx->driver == COGL_DRIVER_GL && !with_color_attrib)
!with_color_attrib)
{ {
if ((pipelines_difference & COGL_PIPELINE_STATE_COLOR) || if ((pipelines_difference & COGL_PIPELINE_STATE_COLOR) ||
/* Assume if we were previously told to skip the color, then /* Assume if we were previously told to skip the color, then
@ -563,7 +562,7 @@ get_max_activateable_texture_units (void)
#endif #endif
#ifdef HAVE_COGL_GL #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 /* GL_MAX_TEXTURE_UNITS defines the number of units that are
usable from the fixed function pipeline, therefore it isn't 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. * glsl progend.
*/ */
#ifdef HAVE_COGL_GL #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)) (layers_difference & COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS))
{ {
CoglPipelineState change = COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS; CoglPipelineState change = COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS;

View File

@ -86,7 +86,7 @@ _cogl_driver_gl_context_init (CoglContext *context,
pipeline to track whether any layers have point sprite coords pipeline to track whether any layers have point sprite coords
enabled. We don't need to do this for GL3 or GLES2 because point enabled. We don't need to do this for GL3 or GLES2 because point
sprites are handled using a builtin varying in the shader. */ 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)); GE (context, glEnable (GL_POINT_SPRITE));
return TRUE; return TRUE;
@ -504,7 +504,6 @@ _cogl_driver_update_features (CoglContext *ctx,
if (ctx->driver == COGL_DRIVER_GL) if (ctx->driver == COGL_DRIVER_GL)
{ {
/* Features which are not available in GL 3 */ /* 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_TEST, TRUE);
COGL_FLAGS_SET (private_features, COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, TRUE); COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, TRUE);