From 4800a4e55213ff764ccbda63603f9a26095baca3 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 19 Jan 2026 15:03:26 +1000 Subject: [PATCH] PostProcessing: Avoid creating zero-sized intermediate targets --- src/util/postprocessing_shader_fx.cpp | 4 ++-- src/util/postprocessing_shader_slang.cpp | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/util/postprocessing_shader_fx.cpp b/src/util/postprocessing_shader_fx.cpp index 1f8162d57..2019925e4 100644 --- a/src/util/postprocessing_shader_fx.cpp +++ b/src/util/postprocessing_shader_fx.cpp @@ -1586,8 +1586,8 @@ bool PostProcessing::ReShadeFXShader::ResizeTargets(u32 source_width, u32 source if (!tex.render_target) continue; - const u32 t_width = (tex.render_target_width > 0) ? tex.render_target_width : target_width; - const u32 t_height = (tex.render_target_height > 0) ? tex.render_target_height : target_height; + const u32 t_width = (tex.render_target_width > 0) ? tex.render_target_width : std::max(target_width, 1); + const u32 t_height = (tex.render_target_height > 0) ? tex.render_target_height : std::max(target_height, 1); if (!g_gpu_device->ResizeTexture(&tex.texture, t_width, t_height, GPUTexture::Type::RenderTarget, tex.format, tex.storage_access ? GPUTexture::Flags::AllowBindAsImage : GPUTexture::Flags::None, false, error)) diff --git a/src/util/postprocessing_shader_slang.cpp b/src/util/postprocessing_shader_slang.cpp index 6e7664d8b..e900b69b9 100644 --- a/src/util/postprocessing_shader_slang.cpp +++ b/src/util/postprocessing_shader_slang.cpp @@ -1996,10 +1996,12 @@ bool PostProcessing::SlangShader::ResizeTargets(u32 source_width, u32 source_hei if (pass.output_texture_id < 0) continue; - const u32 tex_width = - apply_scale(pass.output_scale[0].first, pass.output_scale[0].second, prev_width, viewport_width, source_width); - const u32 tex_height = - apply_scale(pass.output_scale[1].first, pass.output_scale[1].second, prev_height, viewport_height, source_height); + const u32 tex_width = std::max( + apply_scale(pass.output_scale[0].first, pass.output_scale[0].second, prev_width, viewport_width, source_width), + 1); + const u32 tex_height = std::max( + apply_scale(pass.output_scale[1].first, pass.output_scale[1].second, prev_height, viewport_height, source_height), + 1); // Source for the next pass is the previous pass's output. prev_width = tex_width;