summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/PixelShaderGen.cpp
diff options
context:
space:
mode:
authorTechjar <tecknojar@gmail.com>2019-04-03 04:58:59 -0400
committerTechjar <tecknojar@gmail.com>2019-04-03 10:09:05 -0400
commita318c55cec3031dcf09bb7d3e547c4a95634b84f (patch)
tree3a261e1bf88ad9877027b35cc019561ba441d157 /Source/Core/VideoCommon/PixelShaderGen.cpp
parenta2df9beb9f0493eea58a5ef1fe211e2a7932b590 (diff)
PixelShaderGen: Fix bounding box coordinates being offset by 1 pixel
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index 7a771c430e..7064552e7d 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -481,23 +481,23 @@ void UpdateBoundingBox(float2 rawpos) {
offset.y = -offset.y;
#endif
- // The bounding box register is exclusive of the right coordinate, hence the +1.
- int2 min_pos = iround(rawpos * cefbscale + offset);
- int2 max_pos = min_pos + int2(1, 1);
+ // The rightmost shaded pixel is not included in the right bounding box register,
+ // such that width = right - left + 1. This has been verified on hardware.
+ int2 pos = iround(rawpos * cefbscale + offset);
#ifdef SUPPORTS_SUBGROUP_REDUCTION
if (CAN_USE_SUBGROUP_REDUCTION) {
- min_pos = IS_HELPER_INVOCATION ? int2(2147483647, 2147483647) : min_pos;
- max_pos = IS_HELPER_INVOCATION ? int2(-2147483648, -2147483648) : max_pos;
+ int2 min_pos = IS_HELPER_INVOCATION ? int2(2147483647, 2147483647) : pos;
+ int2 max_pos = IS_HELPER_INVOCATION ? int2(-2147483648, -2147483648) : pos;
SUBGROUP_MIN(min_pos);
SUBGROUP_MAX(max_pos);
if (IS_FIRST_ACTIVE_INVOCATION)
UpdateBoundingBoxBuffer(min_pos, max_pos);
} else {
- UpdateBoundingBoxBuffer(min_pos, max_pos);
+ UpdateBoundingBoxBuffer(pos, pos);
}
#else
- UpdateBoundingBoxBuffer(min_pos, max_pos);
+ UpdateBoundingBoxBuffer(pos, pos);
#endif
}