fixed black screen flickering when using Metal render driver on Mac
authorHolger Schemel <holger.schemel@virtion.de>
Tue, 14 Jan 2025 07:33:45 +0000 (08:33 +0100)
committerHolger Schemel <holger.schemel@virtion.de>
Tue, 14 Jan 2025 08:34:24 +0000 (09:34 +0100)
src/libgame/sdl.c

index 8bb732abf815c8a426fc435f29478def08a5da85..e9a44036ba416db3fb2f4e8e09725f88d4dd70ca 100644 (file)
@@ -205,14 +205,14 @@ static void UpdateScreenExt(SDL_Rect *rect, boolean with_frame_delay)
   }
 #endif
 
-  // clear render target buffer
-  SDL_RenderClear(sdl_renderer);
-
   // set renderer to use target texture for rendering
   if (video.screen_rendering_mode == SPECIAL_RENDERING_TARGET ||
       video.screen_rendering_mode == SPECIAL_RENDERING_DOUBLE)
     SDL_SetRenderTarget(sdl_renderer, sdl_texture_target);
 
+  // clear render target buffer
+  SDL_RenderClear(sdl_renderer);
+
   // copy backbuffer texture to render target buffer
   if (video.screen_rendering_mode != SPECIAL_RENDERING_TARGET)
     SDL_RenderCopy(sdl_renderer, sdl_texture_stream, src_rect1, dst_rect1);