Skip to content

Commit

Permalink
rsx: Fix virtual coordinate clamping
Browse files Browse the repository at this point in the history
  • Loading branch information
kd-11 committed Jul 4, 2023
1 parent 10af0e8 commit 79e000f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rpcs3/Emu/RSX/Common/texture_cache_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,15 +518,17 @@ 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;
desc.texcoord_xform.bias[0] += offset_x;
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;
}

Expand Down

0 comments on commit 79e000f

Please sign in to comment.