From 00362e9f4eb8261a457abf1caff7272cc274b288 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 24 Mar 2022 20:35:29 +0900 Subject: [PATCH] [gl] Explicitly request compatibility profile And core profile for glsl --- include/vid_gl.h | 2 +- libs/video/renderer/vid_render_gl.c | 2 +- libs/video/renderer/vid_render_glsl.c | 2 +- libs/video/targets/vid_win_gl.c | 2 +- libs/video/targets/vid_x11_gl.c | 12 ++++++++++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/vid_gl.h b/include/vid_gl.h index 8b82ae069..26d445770 100644 --- a/include/vid_gl.h +++ b/include/vid_gl.h @@ -8,7 +8,7 @@ typedef struct gl_ctx_s { GL_context context; void (*load_gl) (void); void (*choose_visual) (struct gl_ctx_s *ctx); - void (*create_context) (struct gl_ctx_s *ctx); + void (*create_context) (struct gl_ctx_s *ctx, int core); void (*init_gl) (void); void *(*get_proc_address) (const char *name, qboolean crit); void (*end_rendering) (void); diff --git a/libs/video/renderer/vid_render_gl.c b/libs/video/renderer/vid_render_gl.c index 38ecf6afb..9647c01aa 100644 --- a/libs/video/renderer/vid_render_gl.c +++ b/libs/video/renderer/vid_render_gl.c @@ -147,7 +147,7 @@ gl_vid_render_choose_visual (void *data) static void gl_vid_render_create_context (void *data) { - gl_ctx->create_context (gl_ctx); + gl_ctx->create_context (gl_ctx, 0); } static vid_model_funcs_t model_funcs = { diff --git a/libs/video/renderer/vid_render_glsl.c b/libs/video/renderer/vid_render_glsl.c index d7eea168b..19c8d3c95 100644 --- a/libs/video/renderer/vid_render_glsl.c +++ b/libs/video/renderer/vid_render_glsl.c @@ -55,7 +55,7 @@ glsl_vid_render_choose_visual (void *data) static void glsl_vid_render_create_context (void *data) { - glsl_ctx->create_context (glsl_ctx); + glsl_ctx->create_context (glsl_ctx, 1); } static vid_model_funcs_t model_funcs = { diff --git a/libs/video/targets/vid_win_gl.c b/libs/video/targets/vid_win_gl.c index 1975b8741..8723225c8 100644 --- a/libs/video/targets/vid_win_gl.c +++ b/libs/video/targets/vid_win_gl.c @@ -117,7 +117,7 @@ wgl_set_pixel_format (void) } static void -wgl_create_context (gl_ctx_t *ctx) +wgl_create_context (gl_ctx_t *ctx, int core) { DWORD lasterror; diff --git a/libs/video/targets/vid_x11_gl.c b/libs/video/targets/vid_x11_gl.c index 7f6285506..a29b01d74 100644 --- a/libs/video/targets/vid_x11_gl.c +++ b/libs/video/targets/vid_x11_gl.c @@ -66,6 +66,12 @@ #define GLX_STENCIL_SIZE 13 // number of stencil bits #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define GLX_CONTEXT_FLAGS_ARB 0x2094 +#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 +#define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001 +#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 +#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 #define GLX_X_RENDERABLE 0x8012 #define GLX_DRAWABLE_TYPE 0x8010 @@ -187,12 +193,14 @@ glx_choose_visual (gl_ctx_t *ctx) } static void -glx_create_context (gl_ctx_t *ctx) +glx_create_context (gl_ctx_t *ctx, int core) { int attribs[] = { GLX_CONTEXT_MAJOR_VERSION_ARB, 3, GLX_CONTEXT_MINOR_VERSION_ARB, 0, - //GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB + GLX_CONTEXT_PROFILE_MASK_ARB, + core ? GLX_CONTEXT_CORE_PROFILE_BIT_ARB + : GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, None }; XSync (x_disp, 0);