summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/GeometryShaderGen.cpp
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2021-12-23 17:47:12 -0800
committerPokechu22 <Pokechu022@gmail.com>2021-12-23 17:56:21 -0800
commit1cd148d4c52ecb61f562b6f7fb37d39157c34b6e (patch)
tree1c77e6555a34eba7026493faf99cdee3ae08c03f /Source/Core/VideoCommon/GeometryShaderGen.cpp
parent6dae4043cb967925ae28cce92d9c100330a5d17e (diff)
GeomeryShaderGen: Set gl_ClipDistance on Vulkan as well as OpenGL
Fixes https://bugs.dolphin-emu.org/issues/12548
Diffstat (limited to 'Source/Core/VideoCommon/GeometryShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/GeometryShaderGen.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/Source/Core/VideoCommon/GeometryShaderGen.cpp b/Source/Core/VideoCommon/GeometryShaderGen.cpp
index 4108a6efd6..165e4c66a5 100644
--- a/Source/Core/VideoCommon/GeometryShaderGen.cpp
+++ b/Source/Core/VideoCommon/GeometryShaderGen.cpp
@@ -331,9 +331,14 @@ static void EmitVertex(ShaderCode& out, const ShaderHostConfig& host_config,
if (wireframe && first_vertex)
out.Write("\tif (i == 0) first = {};\n", vertex);
- if (api_type == APIType::OpenGL)
+ if (api_type == APIType::OpenGL || api_type == APIType::Vulkan)
{
- out.Write("\tgl_Position = {}.pos;\n", vertex);
+ // Vulkan NDC space has Y pointing down (right-handed NDC space).
+ if (api_type == APIType::Vulkan)
+ out.Write("\tgl_Position = float4({0}.pos.x, -{0}.pos.y, {0}.pos.z, {0}.pos.w);\n", vertex);
+ else
+ out.Write("\tgl_Position = {}.pos;\n", vertex);
+
if (host_config.backend_depth_clamp)
{
out.Write("\tgl_ClipDistance[0] = {}.clipDist0;\n", vertex);
@@ -341,13 +346,6 @@ static void EmitVertex(ShaderCode& out, const ShaderHostConfig& host_config,
}
AssignVSOutputMembers(out, "ps", vertex, uid_data->numTexGens, host_config);
}
- else if (api_type == APIType::Vulkan)
- {
- // Vulkan NDC space has Y pointing down (right-handed NDC space).
- out.Write("\tgl_Position = {}.pos;\n", vertex);
- out.Write("\tgl_Position.y = -gl_Position.y;\n");
- AssignVSOutputMembers(out, "ps", vertex, uid_data->numTexGens, host_config);
- }
else
{
out.Write("\tps.o = {};\n", vertex);