SDL: Always blit to the swapchain in GPU_RenderPresent

From 1a13acac0926f02f202e358036d855cec3840935 Mon Sep 17 00:00:00 2001
From: cosmonaut <[EMAIL REDACTED]>
Date: Sat, 7 Sep 2024 08:43:02 -0700
Subject: [PATCH] Always blit to the swapchain in GPU_RenderPresent

Fixes #10744
---
 include/SDL3/SDL_gpu.h             |  2 +-
 src/render/sdlgpu/SDL_render_gpu.c | 38 ++++++++++--------------------
 2 files changed, 14 insertions(+), 26 deletions(-)

diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h
index fe2692fd2360f..c6402bbcaefec 100644
--- a/include/SDL3/SDL_gpu.h
+++ b/include/SDL3/SDL_gpu.h
@@ -1,4 +1,4 @@
-/*
+/*
   Simple DirectMedia Layer
   Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
 
diff --git a/src/render/sdlgpu/SDL_render_gpu.c b/src/render/sdlgpu/SDL_render_gpu.c
index af5f61dd4e85c..cd286bb51b014 100644
--- a/src/render/sdlgpu/SDL_render_gpu.c
+++ b/src/render/sdlgpu/SDL_render_gpu.c
@@ -965,35 +965,23 @@ static bool GPU_RenderPresent(SDL_Renderer *renderer)
     }
 
     SDL_GPUTextureFormat swapchain_fmt = SDL_GetGPUSwapchainTextureFormat(data->device, renderer->window);
+    SDL_GPUBlitRegion src;
+    SDL_zero(src);
+    src.texture = data->backbuffer.texture;
+    src.w = data->backbuffer.width;
+    src.h = data->backbuffer.height;
+
+    SDL_GPUBlitRegion dst;
+    SDL_zero(dst);
+    dst.texture = swapchain;
+    dst.w = swapchain_w;
+    dst.h = swapchain_h;
+
+    SDL_BlitGPUTexture(data->state.command_buffer, &src, &dst, SDL_FLIP_NONE, SDL_GPU_FILTER_LINEAR, true);
 
     if (swapchain_w != data->backbuffer.width || swapchain_h != data->backbuffer.height || swapchain_fmt != data->backbuffer.format) {
-        SDL_GPUBlitRegion src;
-        SDL_zero(src);
-        src.texture = data->backbuffer.texture;
-        src.w = data->backbuffer.width;
-        src.h = data->backbuffer.height;
-
-        SDL_GPUBlitRegion dst;
-        SDL_zero(dst);
-        dst.texture = swapchain;
-        dst.w = swapchain_w;
-        dst.h = swapchain_h;
-
-        SDL_BlitGPUTexture(data->state.command_buffer, &src, &dst, SDL_FLIP_NONE, SDL_GPU_FILTER_LINEAR, true);
         SDL_ReleaseGPUTexture(data->device, data->backbuffer.texture);
         CreateBackbuffer(data, swapchain_w, swapchain_h, swapchain_fmt);
-    } else {
-        SDL_GPUTextureLocation src;
-        SDL_zero(src);
-        src.texture = data->backbuffer.texture;
-
-        SDL_GPUTextureLocation dst;
-        SDL_zero(dst);
-        dst.texture = swapchain;
-
-        SDL_GPUCopyPass *pass = SDL_BeginGPUCopyPass(data->state.command_buffer);
-        SDL_CopyGPUTextureToTexture(pass, &src, &dst, swapchain_w, swapchain_h, 1, true);
-        SDL_EndGPUCopyPass(pass);
     }
 
 // *** FIXME ***