aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-07-28 19:01:11 -0300
committerGitHub <noreply@github.com>2020-07-29 08:01:11 +1000
commit991784868f278b62f7e847321f0cfd7309fe2f79 (patch)
treed861d050233c3c54f8c8dc3dc64d3f4e002ca427 /Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
parent43c13057da7726c324f2b5d674e5e1308eb1f6a7 (diff)
Fix shader regression on Intel iGPUs by reverting layout changes (#1425)
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs')
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs38
1 files changed, 28 insertions, 10 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
index 40e277e0..a7b67a60 100644
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
+++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
@@ -430,11 +430,20 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
};
}
- for (int c = 0; c < 4; c++)
+ string name = $"{DefaultNames.IAttributePrefix}{attr}";
+
+ if ((context.Config.Flags & TranslationFlags.Feedback) != 0)
{
- char swzMask = "xyzw"[c];
+ for (int c = 0; c < 4; c++)
+ {
+ char swzMask = "xyzw"[c];
- context.AppendLine($"layout (location = {attr}, component = {c}) {iq}in float {DefaultNames.IAttributePrefix}{attr}_{swzMask}{suffix};");
+ context.AppendLine($"layout (location = {attr}, component = {c}) {iq}in float {name}_{swzMask}{suffix};");
+ }
+ }
+ else
+ {
+ context.AppendLine($"layout (location = {attr}) {iq}in vec4 {name}{suffix};");
}
}
}
@@ -463,23 +472,32 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
{
for (int attr = 0; attr < MaxAttributes; attr++)
{
- for (int c = 0; c < 4; c++)
- {
- char swzMask = "xyzw"[c];
-
- context.AppendLine($"layout (location = {attr}, component = {c}) out float {DefaultNames.OAttributePrefix}{attr}_{swzMask};");
- }
+ DeclareOutputAttribute(context, attr);
}
foreach (int attr in info.OAttributes.OrderBy(x => x).Where(x => x >= MaxAttributes))
{
+ DeclareOutputAttribute(context, attr);
+ }
+ }
+
+ private static void DeclareOutputAttribute(CodeGenContext context, int attr)
+ {
+ string name = $"{DefaultNames.OAttributePrefix}{attr}";
+
+ if ((context.Config.Flags & TranslationFlags.Feedback) != 0)
+ {
for (int c = 0; c < 4; c++)
{
char swzMask = "xyzw"[c];
- context.AppendLine($"layout (location = {attr}, component = {c}) out float {DefaultNames.OAttributePrefix}{attr}_{swzMask};");
+ context.AppendLine($"layout (location = {attr}, component = {c}) out float {name}_{swzMask};");
}
}
+ else
+ {
+ context.AppendLine($"layout (location = {attr}) out vec4 {name};");
+ }
}
private static void AppendHelperFunction(CodeGenContext context, string filename)