From 010d68ed5a70451f1d60df4823cd1b850e201059 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 17 Sep 2024 17:53:29 +0800 Subject: [PATCH] cogl/gl: Don't initialize potentially unused/unsupported functions `_cogl_context_get_gl_extensions` is their only user and it only uses them for GL 3.0 so do the GL version check first. Part-of: --- cogl/cogl/driver/gl/gl/cogl-driver-gl.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c index 944901861..06a7fb980 100644 --- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c +++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c @@ -468,12 +468,6 @@ _cogl_driver_update_features (CoglContext *ctx, ctx->glGetString = (void *) cogl_renderer_get_proc_address (ctx->display->renderer, "glGetString"); - ctx->glGetStringi = - (void *) cogl_renderer_get_proc_address (ctx->display->renderer, - "glGetStringi"); - ctx->glGetIntegerv = - (void *) cogl_renderer_get_proc_address (ctx->display->renderer, - "glGetIntegerv"); if (!check_gl_version (ctx, error)) return FALSE; @@ -485,6 +479,16 @@ _cogl_driver_update_features (CoglContext *ctx, if (!check_glsl_version (ctx, error)) return FALSE; + /* These are only used in _cogl_context_get_gl_extensions for GL 3.0 + * so don't look them up before check_gl_version() + */ + ctx->glGetStringi = + (void *) cogl_renderer_get_proc_address (ctx->display->renderer, + "glGetStringi"); + ctx->glGetIntegerv = + (void *) cogl_renderer_get_proc_address (ctx->display->renderer, + "glGetIntegerv"); + gl_extensions = _cogl_context_get_gl_extensions (ctx); if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS)))