diff options
| author | JMC47 <JMC4789@gmail.com> | 2021-12-27 02:04:59 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-27 02:04:59 -0500 |
| commit | 4dcf2327eb873ffaf7eeb0b6b1cc6b49fa8778f1 (patch) | |
| tree | 74af6006f0a4e08e538b4d5e8cfb0abcbeba7f3e /Source | |
| parent | 1f1e78ee7a29c5f4ddf7ba7d39057f42829ef72c (diff) | |
| parent | 1cd148d4c52ecb61f562b6f7fb37d39157c34b6e (diff) | |
Merge pull request #10286 from Pokechu22/geometry-shader-depth-clamp
GeomeryShaderGen: Set gl_ClipDistance on Vulkan as well as OpenGL
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/VideoCommon/GeometryShaderGen.cpp | 16 |
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); |
