GeomeryShaderGen: Set gl_ClipDistance on Vulkan as well as OpenGL

Fixes https://bugs.dolphin-emu.org/issues/12548
This commit is contained in:
Pokechu22 2021-12-23 17:47:12 -08:00
parent 6dae4043cb
commit 1cd148d4c5
1 changed files with 7 additions and 9 deletions

View File

@ -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);