cogl: Remove legacy OpenGL driver support

This means the two Cogl drivers left are OpenGL >= 3.1 and GLES >= 2.0.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2672>
This commit is contained in:
Jonas Ådahl 2022-10-18 21:52:10 +02:00 committed by Marge Bot
parent e5195c08a4
commit b2579750a7
13 changed files with 13 additions and 74 deletions

View File

@ -283,7 +283,6 @@ static const struct {
CoglDriver driver_id;
} all_known_drivers[] = {
{ "gl3", "OpenGL 3.2 core profile", COGL_DRIVER_GL3 },
{ "gl", "OpenGL legacy profile", COGL_DRIVER_GL },
{ "gles2", "OpenGL ES 2.0", COGL_DRIVER_GLES2 },
{ "any", "Default Cogl driver", COGL_DRIVER_ANY },
};

View File

@ -65,15 +65,13 @@ _cogl_feature_check (CoglRenderer *renderer,
case COGL_DRIVER_ANY:
g_assert_not_reached ();
case COGL_DRIVER_NOP:
case COGL_DRIVER_GL:
case COGL_DRIVER_GL3:
break;
}
/* First check whether the functions should be directly provided by
GL */
if (((driver == COGL_DRIVER_GL ||
driver == COGL_DRIVER_GL3) &&
if ((driver == COGL_DRIVER_GL3 &&
COGL_CHECK_GL_VERSION (gl_major, gl_minor,
data->min_gl_major, data->min_gl_minor)) ||
(data->gles_availability & gles_availability))

View File

@ -88,15 +88,6 @@ typedef struct _CoglDriverDescription
static CoglDriverDescription _cogl_drivers[] =
{
#ifdef HAVE_COGL_GL
{
COGL_DRIVER_GL,
"gl",
{ COGL_PRIVATE_FEATURE_ANY_GL,
-1 },
&_cogl_driver_gl,
&_cogl_texture_driver_gl,
COGL_GL_LIBNAME,
},
{
COGL_DRIVER_GL3,
"gl3",
@ -344,8 +335,6 @@ driver_id_to_name (CoglDriver id)
{
switch (id)
{
case COGL_DRIVER_GL:
return "gl";
case COGL_DRIVER_GL3:
return "gl3";
case COGL_DRIVER_GLES2:

View File

@ -292,7 +292,6 @@ cogl_renderer_remove_constraint (CoglRenderer *renderer,
* CoglDriver:
* @COGL_DRIVER_ANY: Implies no preference for which driver is used
* @COGL_DRIVER_NOP: A No-Op driver.
* @COGL_DRIVER_GL: An OpenGL driver.
* @COGL_DRIVER_GL3: An OpenGL driver using the core GL 3.1 profile
* @COGL_DRIVER_GLES2: An OpenGL ES 2.0 driver.
*
@ -303,7 +302,6 @@ typedef enum
{
COGL_DRIVER_ANY,
COGL_DRIVER_NOP,
COGL_DRIVER_GL,
COGL_DRIVER_GL3,
COGL_DRIVER_GLES2,
} CoglDriver;

View File

@ -456,20 +456,6 @@ get_max_activateable_texture_units (void)
}
#endif
#ifdef HAVE_COGL_GL
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
available in GLES2. These are also tied to the number of
texture coordinates that can be uploaded so it should be less
than that available from the shader extensions */
GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_UNITS,
values + n_values++));
}
#endif
g_assert (n_values <= G_N_ELEMENTS (values) &&
n_values > 0);

View File

@ -64,19 +64,8 @@ _cogl_driver_gl_real_context_init (CoglContext *context)
context->glBindVertexArray (vertex_array);
}
/* As far as I can tell, GL_POINT_SPRITE doesn't have any effect
unless GL_COORD_REPLACE is enabled for an individual layer.
Therefore it seems like it should be ok to just leave it enabled
all the time instead of having to have a set property on each
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 (context->driver == COGL_DRIVER_GL)
GE (context, glEnable (GL_POINT_SPRITE));
/* There's no enable for this in GLES2, it's always on */
if (context->driver == COGL_DRIVER_GL ||
context->driver == COGL_DRIVER_GL3)
if (context->driver == COGL_DRIVER_GL3)
GE (context, glEnable (GL_PROGRAM_POINT_SIZE) );
return TRUE;
@ -518,13 +507,6 @@ _cogl_driver_update_features (CoglContext *ctx,
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE, TRUE);
if (ctx->driver == COGL_DRIVER_GL)
{
/* Features which are not available in GL 3 */
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, TRUE);
}
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_STRIDE, TRUE);
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ANY_GL, TRUE);
@ -568,8 +550,7 @@ _cogl_driver_update_features (CoglContext *ctx,
g_strfreev (gl_extensions);
if (!COGL_FLAGS_GET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES) &&
!COGL_FLAGS_GET (private_features, COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE))
if (!COGL_FLAGS_GET (private_features, COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE))
{
g_set_error (error,
COGL_DRIVER_ERROR,

View File

@ -137,8 +137,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
static void
_cogl_winsys_renderer_bind_api (CoglRenderer *renderer)
{
if (renderer->driver == COGL_DRIVER_GL ||
renderer->driver == COGL_DRIVER_GL3)
if (renderer->driver == COGL_DRIVER_GL3)
eglBindAPI (EGL_OPENGL_API);
else if (renderer->driver == COGL_DRIVER_GLES2)
eglBindAPI (EGL_OPENGL_ES_API);
@ -162,7 +161,7 @@ check_egl_extensions (CoglRenderer *renderer)
for (i = 0; i < G_N_ELEMENTS (winsys_feature_data); i++)
if (_cogl_feature_check (renderer,
"EGL", winsys_feature_data + i, 0, 0,
COGL_DRIVER_GL, /* the driver isn't used */
COGL_DRIVER_GL3, /* the driver isn't used */
split_extensions,
egl_renderer))
{
@ -241,8 +240,7 @@ cogl_display_egl_determine_attributes (CoglDisplay *display,
attributes[i++] = EGL_DONT_CARE;
attributes[i++] = EGL_RENDERABLE_TYPE;
attributes[i++] = ((renderer->driver == COGL_DRIVER_GL ||
renderer->driver == COGL_DRIVER_GL3) ?
attributes[i++] = (renderer->driver == COGL_DRIVER_GL3 ?
EGL_OPENGL_BIT :
EGL_OPENGL_ES2_BIT);

View File

@ -356,7 +356,7 @@ update_base_winsys_features (CoglRenderer *renderer)
"GLX", winsys_feature_data + i,
glx_renderer->glx_major,
glx_renderer->glx_minor,
COGL_DRIVER_GL, /* the driver isn't used */
COGL_DRIVER_GL3, /* the driver isn't used */
split_extensions,
glx_renderer))
{
@ -402,8 +402,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
if (!_cogl_xlib_renderer_connect (renderer, error))
goto error;
if (renderer->driver != COGL_DRIVER_GL &&
renderer->driver != COGL_DRIVER_GL3)
if (renderer->driver != COGL_DRIVER_GL3)
{
g_set_error_literal (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_INIT,

View File

@ -64,7 +64,6 @@ get_x11_cogl_winsys_vtable (CoglRenderer *renderer)
#else
break;
#endif
case COGL_DRIVER_GL:
case COGL_DRIVER_GL3:
#ifdef COGL_HAS_GLX_SUPPORT
return _cogl_winsys_glx_get_vtable ();

View File

@ -179,13 +179,6 @@ check_gl_extensions (void)
return arb_sync && x11_sync_object;
}
case COGL_DRIVER_GL:
{
const char *extensions = meta_gl_get_string (GL_EXTENSIONS);
return (extensions != NULL &&
strstr (extensions, "GL_ARB_sync") != NULL &&
strstr (extensions, "GL_EXT_x11_sync_object") != NULL);
}
default:
break;
}

View File

@ -19,12 +19,12 @@ cogl_tests = [
[ 'test-journal', [] ],
[ 'test-primitive', [] ],
[ 'test-sparse-pipeline', [] ],
[ 'test-read-texture-formats', ['gl', 'gl3'] ],
[ 'test-read-texture-formats', ['gl3'] ],
[ 'test-write-texture-formats', [] ],
[ 'test-point-size', [] ],
[ 'test-point-size-attribute', [] ],
[ 'test-point-sprite', [] ],
[ 'test-point-sprite-known-failure', ['gl', 'gl3', 'gles2'] ],
[ 'test-point-sprite-known-failure', ['gl3', 'gles2'] ],
[ 'test-no-gl-header', [] ],
[ 'test-layer-remove', [] ],
[ 'test-alpha-test', [] ],
@ -72,7 +72,7 @@ test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('G_ENABLE_DIAGNOSTIC', '0')
test_env.set('MUTTER_TEST_PLUGIN_PATH', '@0@'.format(default_plugin.full_path()))
cogl_test_variants = [ 'gl', 'gl3', 'gles2' ]
cogl_test_variants = [ 'gl3', 'gles2' ]
foreach cogl_test: cogl_tests
test_case = cogl_test[0]

View File

@ -15,8 +15,7 @@ test_framebuffer_get_bits (void)
renderer = cogl_context_get_renderer (test_ctx);
if (cogl_renderer_get_driver (renderer) != COGL_DRIVER_GL &&
cogl_renderer_get_driver (renderer) != COGL_DRIVER_GL3)
if (cogl_renderer_get_driver (renderer) != COGL_DRIVER_GL3)
{
g_test_skip ("Test requires OpenGL");
return;

View File

@ -1,4 +1,4 @@
all_variants = ['gl', 'gl3', 'gles2']
all_variants = ['gl3', 'gles2']
any_variant = ['any']
cogl_unit_tests = [