Skip to content

Commit

Permalink
SDL3 return value fixes in gl1_sdl.c and gl3_sdl.c
Browse files Browse the repository at this point in the history
and removed unused code from glimp_sdl3.c
  • Loading branch information
DanielGibson committed Oct 26, 2024
1 parent b74d1a5 commit 07ee830
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/client/refresh/gl1/gl1_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions src/client/refresh/gl3/gl3_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 0 additions & 8 deletions src/client/vid/glimp_sdl3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/*
Expand Down

0 comments on commit 07ee830

Please sign in to comment.