offset storage buffer bindings by 15

This commit is contained in:
Samuliak 2024-05-16 16:06:35 +02:00 committed by Isaac Marovitz
parent e4534bb0e0
commit 05eedc5066
No known key found for this signature in database
GPG Key ID: 97250B2B09A132E1
2 changed files with 4 additions and 2 deletions

View File

@ -600,11 +600,12 @@ namespace Ryujinx.Graphics.Metal
{
if (buffer.Range.Size != 0)
{
// Offset the binding by 15
_storageBuffers.Add(new BufferInfo
{
Handle = buffer.Range.Handle.ToIntPtr(),
Offset = buffer.Range.Offset,
Index = buffer.Binding
Index = buffer.Binding + 15
});
}
}

View File

@ -129,7 +129,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
foreach (var storageBuffers in context.Properties.StorageBuffers.Values)
{
var varType = storageBuffers.Type.Fields[0].Type & ~AggregateType.Array;
args = args.Append($"device {Declarations.GetVarTypeName(context, varType)} *{storageBuffers.Name} [[buffer({storageBuffers.Binding})]]").ToArray();
// Offset the binding by 15 to avoid clashing with the constant buffers
args = args.Append($"device {Declarations.GetVarTypeName(context, varType)} *{storageBuffers.Name} [[buffer({15 + storageBuffers.Binding})]]").ToArray();
}
foreach (var texture in context.Properties.Textures.Values)