Buffer bindings in shader…
Will need to be reworked
This commit is contained in:
parent
192a84aa2d
commit
5a320cca19
1 changed files with 15 additions and 8 deletions
|
@ -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)})";
|
||||
|
|
Loading…
Reference in a new issue