From 79e000f63d0e9588278d3dbd81c89d2b66366fe1 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Tue, 4 Jul 2023 00:50:44 +0300 Subject: [PATCH] rsx: Fix virtual coordinate clamping --- rpcs3/Emu/RSX/Common/texture_cache_helpers.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/texture_cache_helpers.h b/rpcs3/Emu/RSX/Common/texture_cache_helpers.h index 52a73a5bdf..9eb7157ad2 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache_helpers.h +++ b/rpcs3/Emu/RSX/Common/texture_cache_helpers.h @@ -518,6 +518,8 @@ namespace rsx const f32 scale_y = f32(desired_dimensions.height) / actual_dimensions.height; const f32 offset_x = f32(offset.x) / actual_dimensions.width; const f32 offset_y = f32(offset.y) / actual_dimensions.height; + const f32 limit_x = f32(offset.x + desired_dimensions.width - 1) / actual_dimensions.width; + const f32 limit_y = f32(offset.y + desired_dimensions.height - 1) / actual_dimensions.height; desc.texcoord_xform.scale[0] *= scale_x; desc.texcoord_xform.scale[1] *= scale_y; @@ -525,8 +527,8 @@ namespace rsx desc.texcoord_xform.bias[1] += offset_y; desc.texcoord_xform.clamp_min[0] = offset_x; desc.texcoord_xform.clamp_min[1] = offset_y; - desc.texcoord_xform.clamp_max[0] = offset_x + scale_x; - desc.texcoord_xform.clamp_max[1] = offset_y + scale_y; + desc.texcoord_xform.clamp_max[0] = limit_x; + desc.texcoord_xform.clamp_max[1] = limit_y; desc.texcoord_xform.clamp = true; }