Merge pull request #7957 from Techjar/bbox-offset-fix

PixelShaderGen: Fix bounding box right/bottom offset
This commit is contained in:
Connor McLaughlin 2019-04-04 00:22:32 +10:00 committed by GitHub
commit 741a975ac2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -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
}