VideoCommon: fix support of stereoscopic rendering after moving d3d to SPIRV generation

This commit is contained in:
iwubcode 2022-05-20 23:18:23 -05:00
parent 993fa3bf94
commit cad1d6ce90
3 changed files with 23 additions and 13 deletions

View File

@ -123,9 +123,6 @@ ShaderCode GenerateGeometryShaderCode(APIType api_type, const ShaderHostConfig&
GetInterpolationQualifier(msaa, ssaa, true, false),
ShaderStage::Geometry);
if (stereo)
out.Write("\tflat int layer;\n");
out.Write("}} ps;\n");
out.Write("void main()\n{{\n");
@ -136,7 +133,9 @@ ShaderCode GenerateGeometryShaderCode(APIType api_type, const ShaderHostConfig&
out.Write("\tVS_OUTPUT o;\n");
if (stereo)
{
out.Write("\tuint layer : SV_RenderTargetArrayIndex;\n");
}
out.Write("\tfloat4 posout : SV_Position;\n");
out.Write("}};\n");
@ -354,9 +353,12 @@ static void EmitVertex(ShaderCode& out, const ShaderHostConfig& host_config,
if (stereo)
{
// Select the output layer
out.Write("\tps.layer = eye;\n");
if (api_type == APIType::OpenGL || api_type == APIType::Vulkan)
out.Write("\tgl_Layer = eye;\n");
else
{
out.Write("\tps.layer = eye;\n");
}
}
if (api_type == APIType::OpenGL || api_type == APIType::Vulkan)

View File

@ -909,9 +909,6 @@ ShaderCode GeneratePixelShaderCode(APIType api_type, const ShaderHostConfig& hos
GenerateVSOutputMembers(out, api_type, uid_data->genMode_numtexgens, host_config,
GetInterpolationQualifier(msaa, ssaa, true, true), ShaderStage::Pixel);
if (stereo)
out.Write("\tflat int layer;\n");
out.Write("}};\n");
}
else
@ -967,8 +964,15 @@ ShaderCode GeneratePixelShaderCode(APIType api_type, const ShaderHostConfig& hos
{
out.Write("\tfloat4 ocol1;\n");
}
if (!stereo)
if (host_config.backend_geometry_shaders && stereo)
{
out.Write("\tint layer = gl_Layer;\n");
}
else
{
out.Write("\tint layer = 0;\n");
}
out.Write("\tint4 c0 = " I_COLORS "[1], c1 = " I_COLORS "[2], c2 = " I_COLORS
"[3], prev = " I_COLORS "[0];\n"

View File

@ -128,9 +128,6 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config,
GenerateVSOutputMembers(out, api_type, numTexgen, host_config,
GetInterpolationQualifier(msaa, ssaa, true, true), ShaderStage::Pixel);
if (stereo)
out.Write(" flat int layer;\n");
out.Write("}};\n\n");
}
else
@ -538,8 +535,15 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config,
{
out.Write(" float4 ocol1;\n");
}
if (!stereo)
out.Write(" int layer = 0;\n");
if (host_config.backend_geometry_shaders && stereo)
{
out.Write("\tint layer = gl_Layer;\n");
}
else
{
out.Write("\tint layer = 0;\n");
}
out.Write(" int3 tevcoord = int3(0, 0, 0);\n"
" State s;\n"