From 390dd6334190451f96e440e7fc167fdf808315b1 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 12 Sep 2024 18:17:45 +0800 Subject: [PATCH] cogl: Don't _cogl_context_get_gl_extensions before check_gl_version Because for `COGL_DRIVER_GL3`, `_cogl_context_get_gl_extensions` needs to know that the GL version *really* is >= 3.0 before it calls `glGetStringi` which didn't exist prior to GL 3.0 or ES 3.0. This was causing crashes on Xilinx Mali implementations that only support ES 2.0 (hence `glGetStringi` == NULL), but were being forced to call that function before the GL version check which should tell you the function isn't supported. Part-of: --- cogl/cogl/driver/gl/gl/cogl-driver-gl.c | 4 ++-- cogl/cogl/driver/gl/gles/cogl-driver-gles.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c index ef962ae2e..944901861 100644 --- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c +++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c @@ -475,8 +475,6 @@ _cogl_driver_update_features (CoglContext *ctx, (void *) cogl_renderer_get_proc_address (ctx->display->renderer, "glGetIntegerv"); - gl_extensions = _cogl_context_get_gl_extensions (ctx); - if (!check_gl_version (ctx, error)) return FALSE; @@ -487,6 +485,8 @@ _cogl_driver_update_features (CoglContext *ctx, if (!check_glsl_version (ctx, error)) return FALSE; + gl_extensions = _cogl_context_get_gl_extensions (ctx); + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS))) { g_autofree char *all_extensions = g_strjoinv (" ", gl_extensions); diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c index f44531db6..86cbf7ecb 100644 --- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c +++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c @@ -699,8 +699,6 @@ _cogl_driver_update_features (CoglContext *context, (void *) cogl_renderer_get_proc_address (context->display->renderer, "glGetStringi"); - gl_extensions = _cogl_context_get_gl_extensions (context); - if (!check_gl_version (context, error)) return FALSE; @@ -711,6 +709,8 @@ _cogl_driver_update_features (CoglContext *context, if (!check_glsl_version (context, error)) return FALSE; + gl_extensions = _cogl_context_get_gl_extensions (context); + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS))) { g_autofree char *all_extensions = g_strjoinv (" ", gl_extensions);