From: uis Date: Sat, 27 Jan 2024 22:17:00 +0000 (+0300) Subject: Move depth invalidation before swap X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0fee12c29a36d3f36f731545098053b602bdc2cc;p=xonotic%2Fdarkplaces.git Move depth invalidation before swap Still has to figure out how to invalidate on maps without sky even when sky is disabled. --- diff --git a/cl_screen.c b/cl_screen.c index 32ea147b..a0e8bb35 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -2081,7 +2081,9 @@ static void SCR_DrawTouchscreenOverlay(void) } } -static const GLuint drawbuffers[6] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3, GL_STENCIL_ATTACHMENT, GL_DEPTH_ATTACHMENT}; +#ifndef USE_GLES2 +static const GLuint drawbuffers[4] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3}; +#endif void R_ClearScreen(qboolean fogcolor) { float clearcolor[4]; @@ -2102,10 +2104,12 @@ void R_ClearScreen(qboolean fogcolor) // to avoid clamping interfering with strange shadow volume // drawing orders // clear the screen - if(r_sky.integer && !r_refdef.view.isoverlay && r_fbdiscard.integer && qglInvalidateFramebuffer) { + #ifndef USE_GLES2 + if(r_sky.integer && !r_refdef.view.isoverlay && r_fbdiscard.integer > 1 && qglInvalidateFramebuffer) { invalidated = true; - qglInvalidateFramebuffer(GL_FRAMEBUFFER, 6, drawbuffers); + qglInvalidateFramebuffer(GL_FRAMEBUFFER, 4, drawbuffers); } + #endif GL_Clear((invalidated ? 0 : GL_COLOR_BUFFER_BIT) | GL_DEPTH_BUFFER_BIT | (vid.stencil ? GL_STENCIL_BUFFER_BIT : 0), clearcolor, 1.0f, 128); } diff --git a/vid_sdl.c b/vid_sdl.c index 151a73c5..03b72aa6 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -2894,6 +2894,9 @@ void VID_Shutdown (void) gl_platformextensions = ""; } +#ifndef USE_GLES2 +static const GLuint drawbuffers[] = {GL_DEPTH_STENCIL_ATTACHMENT/*GL_STENCIL_ATTACHMENT, GL_DEPTH_ATTACHMENT*/}; +#endif void VID_Finish (void) { #if SDL_MAJOR_VERSION == 1 @@ -2921,6 +2924,10 @@ void VID_Finish (void) CHECKGLERROR if (r_speeds.integer == 2 || gl_finish.integer) GL_Finish(); + #ifndef USE_GLES2 + if(r_fbdiscard.integer && qglInvalidateFramebuffer) + qglInvalidateFramebuffer(GL_FRAMEBUFFER, sizeof(drawbuffers)/sizeof(*drawbuffers), drawbuffers); + #endif #if SDL_MAJOR_VERSION != 1 {