summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/UberShaderPixel.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2019-01-23 18:11:17 +1000
committerStenzek <stenzek@gmail.com>2019-01-23 18:34:22 +1000
commit68cb24172b4e76c96f38b7a44d8d5d45e4adc900 (patch)
treec2d71004767237e71658ea157b4c0d9e6447f265 /Source/Core/VideoCommon/UberShaderPixel.cpp
parent3627ef8a0489765eb10ab29a7988866b52493239 (diff)
ShaderGen: Omit some unused varyings when possible
Removes the clipPos varying unless slow-depth is used, and the clipDistance varyings if geometry shaders are not used.
Diffstat (limited to 'Source/Core/VideoCommon/UberShaderPixel.cpp')
-rw-r--r--Source/Core/VideoCommon/UberShaderPixel.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/UberShaderPixel.cpp b/Source/Core/VideoCommon/UberShaderPixel.cpp
index 4d66fac968..0d5d733fa2 100644
--- a/Source/Core/VideoCommon/UberShaderPixel.cpp
+++ b/Source/Core/VideoCommon/UberShaderPixel.cpp
@@ -59,7 +59,7 @@ ShaderCode GenPixelShader(APIType ApiType, const ShaderHostConfig& host_config,
out.Write("// Pixel UberShader for %u texgens%s%s\n", numTexgen,
early_depth ? ", early-depth" : "", per_pixel_depth ? ", per-pixel depth" : "");
- WritePixelShaderCommonHeader(out, ApiType, numTexgen, per_pixel_lighting, bounding_box);
+ WritePixelShaderCommonHeader(out, ApiType, numTexgen, host_config, bounding_box);
WriteUberShaderCommonHeader(out, ApiType, host_config);
if (per_pixel_lighting)
WriteLightingFunction(out);
@@ -106,7 +106,7 @@ ShaderCode GenPixelShader(APIType ApiType, const ShaderHostConfig& host_config,
if (host_config.backend_geometry_shaders || ApiType == APIType::Vulkan)
{
out.Write("VARYING_LOCATION(0) in VertexData {\n");
- GenerateVSOutputMembers(out, ApiType, numTexgen, per_pixel_lighting,
+ GenerateVSOutputMembers(out, ApiType, numTexgen, host_config,
GetInterpolationQualifier(msaa, ssaa, true, true));
if (stereo)
@@ -122,7 +122,8 @@ ShaderCode GenPixelShader(APIType ApiType, const ShaderHostConfig& host_config,
// Let's set up attributes
for (u32 i = 0; i < numTexgen; ++i)
out.Write("%s in float3 tex%d;\n", GetInterpolationQualifier(msaa, ssaa), i);
- out.Write("%s in float4 clipPos;\n", GetInterpolationQualifier(msaa, ssaa));
+ if (!host_config.fast_depth_calc)
+ out.Write("%s in float4 clipPos;\n", GetInterpolationQualifier(msaa, ssaa));
if (per_pixel_lighting)
{
out.Write("%s in float3 Normal;\n", GetInterpolationQualifier(msaa, ssaa));
@@ -709,8 +710,11 @@ ShaderCode GenPixelShader(APIType ApiType, const ShaderHostConfig& host_config,
for (u32 i = 0; i < numTexgen; ++i)
out.Write(",\n in %s float3 tex%u : TEXCOORD%u", GetInterpolationQualifier(msaa, ssaa), i,
i);
- out.Write("\n,\n in %s float4 clipPos : TEXCOORD%u", GetInterpolationQualifier(msaa, ssaa),
- numTexgen);
+ if (!host_config.fast_depth_calc)
+ {
+ out.Write("\n,\n in %s float4 clipPos : TEXCOORD%u", GetInterpolationQualifier(msaa, ssaa),
+ numTexgen);
+ }
if (per_pixel_lighting)
{
out.Write(",\n in %s float3 Normal : TEXCOORD%u", GetInterpolationQualifier(msaa, ssaa),