From 91aeba6c660d28db3b5a1c232c90ed5e35d48164 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Fri, 8 Oct 2021 22:47:22 +0300 Subject: [PATCH] Request 24-bit depth buffer from SDL Should fix problems caused by 16-bit depth buffer usage --- src/sdl/i_video.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 0ed10463f..b1bf68bce 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1620,6 +1620,11 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) #ifdef HWRENDER if (vid.glstate == VID_GL_LIBRARY_LOADED) flags |= SDL_WINDOW_OPENGL; + + // Without a 24-bit depth buffer many visuals are ruined by z-fighting. + // Some GPU drivers may give us a 16-bit depth buffer since the + // default value for SDL_GL_DEPTH_SIZE is 16. + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); #endif // Create a window