Buffer bindings in shader…

Will need to be reworked
This commit is contained in:
Isaac Marovitz 2024-03-20 18:16:11 -04:00
parent 0162925ff6
commit 9ce7c5550c
No known key found for this signature in database
GPG Key ID: 97250B2B09A132E1
1 changed files with 15 additions and 8 deletions

View File

@ -24,13 +24,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
if (info.Functions.Count != 0)
{
for (int i = 1; i < info.Functions.Count; i++)
{
context.AppendLine($"{GetFunctionSignature(context, info.Functions[i], parameters.Definitions.Stage)};");
}
context.AppendLine();
for (int i = 1; i < info.Functions.Count; i++)
{
PrintFunction(context, info.Functions[i], parameters.Definitions.Stage);
@ -58,7 +51,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
context.LeaveScope();
}
private static string GetFunctionSignature(CodeGenContext context, StructuredFunction function, ShaderStage stage, bool isMainFunc = false)
private static string GetFunctionSignature(
CodeGenContext context,
StructuredFunction function,
ShaderStage stage,
bool isMainFunc = false)
{
string[] args = new string[function.InArguments.Length + function.OutArguments.Length];
@ -115,6 +112,16 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
args = args.Prepend("KernelIn in [[stage_in]]").ToArray();
}
}
foreach (var constantBuffer in context.Properties.ConstantBuffers.Values)
{
args = args.Append($"constant float4 *{constantBuffer.Name} [[buffer({constantBuffer.Binding})]]").ToArray();
}
foreach (var storageBuffers in context.Properties.StorageBuffers.Values)
{
args = args.Append($"device float4 *{storageBuffers.Name} [[buffer({storageBuffers.Binding})]]").ToArray();
}
}
return $"{funcKeyword} {returnType} {funcName ?? function.Name}({string.Join(", ", args)})";