summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/PixelShaderGen.cpp
diff options
context:
space:
mode:
authorConnor McLaughlin <stenzek@gmail.com>2021-06-08 13:24:03 +1000
committerGitHub <noreply@github.com>2021-06-08 13:24:03 +1000
commitc729852d72f7dcd9877fd4b4a002a0f0d91dcd66 (patch)
treecede87d6b18706156ab869b8814832f9f91aba52 /Source/Core/VideoCommon/PixelShaderGen.cpp
parent1b3977990b2617b8caca0c10fe14ab0105c0c568 (diff)
parent4866002c9bf6d4438087c4b53c100d7cf1271084 (diff)
Merge pull request #9782 from Techjar/bbox-ogl-upsidedown-fix
VideoCommon: Perform OpenGL bounding box inversion in pixel shader
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 80d6c09573..37e856ae42 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -499,16 +499,15 @@ void UpdateBoundingBox(float2 rawpos) {{
// such that width = right - left + 1. This has been verified on hardware.
int2 pos = int2(rawpos * cefbscale);
+#ifdef API_OPENGL
+ // We need to invert the Y coordinate due to OpenGL's lower-left origin
+ pos.y = {efb_height} - pos.y - 1;
+#endif
+
// The GC/Wii GPU rasterizes in 2x2 pixel groups, so bounding box values will be rounded to the
// extents of these groups, rather than the exact pixel.
-#ifdef API_OPENGL
- // Need to flip the operands for Y on OpenGL because of lower-left origin.
- int2 pos_tl = int2(pos.x & ~1, pos.y | 1);
- int2 pos_br = int2(pos.x | 1, pos.y & ~1);
-#else
int2 pos_tl = pos & ~1;
int2 pos_br = pos | 1;
-#endif
#ifdef SUPPORTS_SUBGROUP_REDUCTION
if (CAN_USE_SUBGROUP_REDUCTION) {{
@@ -526,7 +525,8 @@ void UpdateBoundingBox(float2 rawpos) {{
#endif
}}
-)");
+)",
+ fmt::arg("efb_height", EFB_HEIGHT));
}
}