aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-04-21 20:35:28 -0300
committerGitHub <noreply@github.com>2020-04-22 09:35:28 +1000
commit03711dd7b5d44e20fb45c728803ea6b9599dec87 (patch)
tree2930956a377d9f79df2750aa06ce1f1928cd30e6 /Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
parent4738113f293ac2477a553225a24b6c489c6855f1 (diff)
Implement SULD shader instruction (#1117)
* Implement SULD shader instruction * Some nits
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs')
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs19
1 files changed, 16 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
index b1291906..36aff3fc 100644
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
+++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
@@ -326,9 +326,16 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
continue;
}
- string imageTypeName = GetImageTypeName(texOp.Type);
+ string layout = texOp.Format.ToGlslFormat();
- context.AppendLine("writeonly uniform " + imageTypeName + " " + imageName + ";");
+ if (!string.IsNullOrEmpty(layout))
+ {
+ layout = "layout(" + layout + ") ";
+ }
+
+ string imageTypeName = GetImageTypeName(texOp.Type, texOp.Format.GetComponentType());
+
+ context.AppendLine("uniform " + layout + imageTypeName + " " + imageName + ";");
}
foreach (KeyValuePair<string, AstTextureOperation> kv in images)
@@ -455,7 +462,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
return typeName;
}
- private static string GetImageTypeName(SamplerType type)
+ private static string GetImageTypeName(SamplerType type, VariableType componentType)
{
string typeName;
@@ -480,6 +487,12 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
typeName += "Array";
}
+ switch (componentType)
+ {
+ case VariableType.U32: typeName = 'u' + typeName; break;
+ case VariableType.S32: typeName = 'i' + typeName; break;
+ }
+
return typeName;
}
}