From 07ee830712126dd0f50540eb6095bdb122c20c68 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Sat, 26 Oct 2024 17:57:58 +0200 Subject: [PATCH] SDL3 return value fixes in gl1_sdl.c and gl3_sdl.c and removed unused code from glimp_sdl3.c --- src/client/refresh/gl1/gl1_sdl.c | 8 ++++++++ src/client/refresh/gl3/gl3_sdl.c | 4 ++++ src/client/vid/glimp_sdl3.c | 8 -------- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/client/refresh/gl1/gl1_sdl.c b/src/client/refresh/gl1/gl1_sdl.c index 987c28c1..93144656 100644 --- a/src/client/refresh/gl1/gl1_sdl.c +++ b/src/client/refresh/gl1/gl1_sdl.c @@ -104,7 +104,11 @@ int RI_PrepareForWindow(void) SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); +#ifdef USE_SDL3 if (SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8) == 0) +#else + if (SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8)) +#endif { gl_state.stencil = true; } @@ -294,7 +298,11 @@ int RI_InitContext(void* win) if (gl_msaa_samples->value) { +#ifdef USE_SDL3 + if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &msaa_samples)) +#else if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &msaa_samples) == 0) +#endif { ri.Cvar_SetValue("r_msaa_samples", msaa_samples); } diff --git a/src/client/refresh/gl3/gl3_sdl.c b/src/client/refresh/gl3/gl3_sdl.c index 1b66abe6..824d8722 100644 --- a/src/client/refresh/gl3/gl3_sdl.c +++ b/src/client/refresh/gl3/gl3_sdl.c @@ -360,7 +360,11 @@ int GL3_InitContext(void* win) if (gl_msaa_samples->value) { +#ifdef USE_SDL3 + if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &msaa_samples)) +#else if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &msaa_samples) == 0) +#endif { ri.Cvar_SetValue("r_msaa_samples", msaa_samples); } diff --git a/src/client/vid/glimp_sdl3.c b/src/client/vid/glimp_sdl3.c index 2b3cc687..215878bf 100644 --- a/src/client/vid/glimp_sdl3.c +++ b/src/client/vid/glimp_sdl3.c @@ -764,18 +764,10 @@ GLimp_GrabInput(qboolean grab) SDL_SetWindowMouseGrab(window, grab ? true : false); } -#ifdef USE_SDL3 if(!SDL_SetWindowRelativeMouseMode(window, grab ? true : false)) { Com_Printf("WARNING: Setting Relative Mousemode failed, reason: %s\n", SDL_GetError()); } -#else - if(SDL_SetWindowRelativeMouseMode(window, grab ? true : false) < 0) - { - Com_Printf("WARNING: Setting Relative Mousemode failed, reason: %s\n", SDL_GetError()); - Com_Printf(" You should probably update to SDL 2.0.3 or newer!\n"); - } -#endif } /*