Implement SULD shader instruction (#1117)

* Implement SULD shader instruction

* Some nits
This commit is contained in:
gdkchan 2020-04-21 20:35:28 -03:00 committed by GitHub
parent 4738113f29
commit 03711dd7b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 620 additions and 109 deletions

View file

@ -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;
}
}