1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-20 07:22:04 +00:00

Buffer bindings in shader…

Will need to be reworked
This commit is contained in:
Isaac Marovitz 2024-03-20 18:16:11 -04:00 committed by Isaac Marovitz
parent 192a84aa2d
commit 5a320cca19

View file

@ -24,13 +24,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
if (info.Functions.Count != 0) 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++) for (int i = 1; i < info.Functions.Count; i++)
{ {
PrintFunction(context, info.Functions[i], parameters.Definitions.Stage); PrintFunction(context, info.Functions[i], parameters.Definitions.Stage);
@ -58,7 +51,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
context.LeaveScope(); 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]; 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(); 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)})"; return $"{funcKeyword} {returnType} {funcName ?? function.Name}({string.Join(", ", args)})";