cogl/gl: Move shared functions to shared file

Cogl shares some GL functions between the GLES and the big
GL drivers. Namely, it shares _cogl_driver_gl_context_init
and _cogl_driver_gl_context_deinit between these two drivers.

The plot twist is: even though these functions are shared and
their prototypes are in cogl-util-gl-private.h, they're actually
implemented inside cogl-driver-gl.c, which is strictly only
about the big GL driver.

This is problematic when building Mutter on ARM v7, where we
need to disable OpenGL, but keep GLES enabled.

Fix this by moving the shared GL functions to a shared GL file.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1151
This commit is contained in:
Georges Basile Stavracas Neto 2020-03-26 18:13:51 -03:00
parent 51cd8aed96
commit 95642d05a6
2 changed files with 27 additions and 17 deletions

View File

@ -34,6 +34,7 @@
#include "cogl-types.h"
#include "cogl-context-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include "driver/gl/cogl-util-gl-private.h"
#ifdef COGL_GL_DEBUG
@ -74,6 +75,27 @@ _cogl_gl_error_to_string (GLenum error_code)
}
#endif /* COGL_GL_DEBUG */
gboolean
_cogl_driver_gl_context_init (CoglContext *context,
GError **error)
{
context->texture_units =
g_array_new (FALSE, FALSE, sizeof (CoglTextureUnit));
/* See cogl-pipeline.c for more details about why we leave texture unit 1
* active by default... */
context->active_texture_unit = 1;
GE (context, glActiveTexture (GL_TEXTURE1));
return TRUE;
}
void
_cogl_driver_gl_context_deinit (CoglContext *context)
{
_cogl_destroy_texture_units (context);
}
GLenum
_cogl_gl_util_get_error (CoglContext *ctx)
{

View File

@ -42,19 +42,13 @@
#include "driver/gl/cogl-attribute-gl-private.h"
#include "driver/gl/cogl-clip-stack-gl-private.h"
#include "driver/gl/cogl-buffer-gl-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
gboolean
_cogl_driver_gl_context_init (CoglContext *context,
static gboolean
_cogl_driver_gl_real_context_init (CoglContext *context,
GError **error)
{
context->texture_units =
g_array_new (FALSE, FALSE, sizeof (CoglTextureUnit));
/* See cogl-pipeline.c for more details about why we leave texture unit 1
* active by default... */
context->active_texture_unit = 1;
GE (context, glActiveTexture (GL_TEXTURE1));
_cogl_driver_gl_context_init (context, error);
if ((context->driver == COGL_DRIVER_GL3))
{
@ -88,12 +82,6 @@ _cogl_driver_gl_context_init (CoglContext *context,
return TRUE;
}
void
_cogl_driver_gl_context_deinit (CoglContext *context)
{
_cogl_destroy_texture_units (context);
}
static gboolean
_cogl_driver_pixel_format_from_gl_internal (CoglContext *context,
GLenum gl_int_format,
@ -543,7 +531,7 @@ _cogl_driver_update_features (CoglContext *ctx,
const CoglDriverVtable
_cogl_driver_gl =
{
_cogl_driver_gl_context_init,
_cogl_driver_gl_real_context_init,
_cogl_driver_gl_context_deinit,
_cogl_driver_pixel_format_from_gl_internal,
_cogl_driver_pixel_format_to_gl,