Drop the extra full-screen copy at render scale < 1

The SDL_GPU pipeline renders into its own view-sized colour target and
already composites it over the whole render target, so routing it through
gpu_scene_texture cost one extra same-size copy per frame. The scaled
intermediate is now used only by the SDL geometry fallback; the hardware
composite upscales with linear filtering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-12 17:19:51 +09:00
co-authored by Claude Opus 5.5
parent b57f2fba99
commit df87bc64eb
4 changed files with 21 additions and 2 deletions
+5 -2
View File
@@ -2193,7 +2193,10 @@ const auto profileActiveStart = std::chrono::steady_clock::now();
uint32_t clear_col = (last_phase == "game") ? current_env.fog.GetColorUint() : 0x00000000;
if (use_gpu_raster) {
// High Performance Hardware-Accelerated GPU Pipeline (Metal / Vulkan via SDL_RenderGeometry)
if (gpu_scene_texture) {
// Only the SDL geometry fallback rasterizes at screen coordinates and needs the
// scaled intermediate; the hardware pipeline upscales its colour target in one blit.
const bool scaled_target = gpu_scene_texture && !renderer3d->HasHardwarePipeline();
if (scaled_target) {
SDL_SetRenderTarget(renderer.get(), gpu_scene_texture.get());
SDL_SetRenderDrawColor(renderer.get(), (clear_col >> 16) & 0xFF, (clear_col >> 8) & 0xFF, clear_col & 0xFF, (clear_col >> 24) & 0xFF);
SDL_RenderClear(renderer.get());
@@ -2201,7 +2204,7 @@ const auto profileActiveStart = std::chrono::steady_clock::now();
renderer3d->RenderSceneGPU(renderer.get(), draw_list);
if (gpu_scene_texture) {
if (scaled_target) {
SDL_SetRenderTarget(renderer.get(), nullptr);
SDL_FRect dst = { 0.0f, 0.0f, static_cast<float>(screen_width), static_cast<float>(screen_height) };
SDL_RenderTexture(renderer.get(), gpu_scene_texture.get(), nullptr, &dst);