PostProcessing: Avoid creating zero-sized intermediate targets

pull/3687/head
Stenzek 7 months ago
parent 962454bbf4
commit 4800a4e552
No known key found for this signature in database

@ -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<u32>(target_width, 1);
const u32 t_height = (tex.render_target_height > 0) ? tex.render_target_height : std::max<u32>(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))

@ -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<u32>(
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<u32>(
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;

Loading…
Cancel
Save