aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/CodeGen/Glsl/GlslGenerator.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-08-11 17:27:00 -0300
committerGitHub <noreply@github.com>2021-08-11 22:27:00 +0200
commited754af8d5046d2fd7218c742521e38ab17cbcfe (patch)
treed47eda40349a7b4b3fc34d9db9ddeea8f2d0676a /Ryujinx.Graphics.Shader/CodeGen/Glsl/GlslGenerator.cs
parent10d649e6d3ad3e4af32d2b41e718bb0a2924da67 (diff)
Make sure attributes used on subsequent shader stages are initialized (#2538)
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/GlslGenerator.cs')
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/GlslGenerator.cs40
1 files changed, 0 insertions, 40 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/GlslGenerator.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/GlslGenerator.cs
index e1da1a56..6ea700ac 100644
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/GlslGenerator.cs
+++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/GlslGenerator.cs
@@ -49,46 +49,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
Declarations.DeclareLocals(context, function);
- if (funcName == MainFunctionName)
- {
- // Some games will leave some elements of gl_Position uninitialized,
- // in those cases, the elements will contain undefined values according
- // to the spec, but on NVIDIA they seems to be always initialized to (0, 0, 0, 1),
- // so we do explicit initialization to avoid UB on non-NVIDIA gpus.
- if (context.Config.Stage == ShaderStage.Vertex)
- {
- context.AppendLine("gl_Position = vec4(0.0, 0.0, 0.0, 1.0);");
- }
-
- // Ensure that unused attributes are set, otherwise the downstream
- // compiler may eliminate them.
- // (Not needed for fragment shader as it is the last stage).
- if (context.Config.Stage != ShaderStage.Compute &&
- context.Config.Stage != ShaderStage.Fragment &&
- !context.Config.GpPassthrough)
- {
- for (int attr = 0; attr < Declarations.MaxAttributes; attr++)
- {
- if (info.OAttributes.Contains(attr))
- {
- continue;
- }
-
- if ((context.Config.Options.Flags & TranslationFlags.Feedback) != 0)
- {
- context.AppendLine($"{DefaultNames.OAttributePrefix}{attr}_x = 0.0;");
- context.AppendLine($"{DefaultNames.OAttributePrefix}{attr}_y = 0.0;");
- context.AppendLine($"{DefaultNames.OAttributePrefix}{attr}_z = 0.0;");
- context.AppendLine($"{DefaultNames.OAttributePrefix}{attr}_w = 1.0;");
- }
- else
- {
- context.AppendLine($"{DefaultNames.OAttributePrefix}{attr} = vec4(0.0, 0.0, 0.0, 1.0);");
- }
- }
- }
- }
-
PrintBlock(context, function.MainBlock);
context.LeaveScope();