1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-24 09:46:02 +00:00

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 f56117a5c7
commit 262452f586
2 changed files with 4 additions and 2 deletions

View file

@ -600,11 +600,12 @@ namespace Ryujinx.Graphics.Metal
{ {
if (buffer.Range.Size != 0) if (buffer.Range.Size != 0)
{ {
// Offset the binding by 15
_storageBuffers.Add(new BufferInfo _storageBuffers.Add(new BufferInfo
{ {
Handle = buffer.Range.Handle.ToIntPtr(), Handle = buffer.Range.Handle.ToIntPtr(),
Offset = buffer.Range.Offset, 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) foreach (var storageBuffers in context.Properties.StorageBuffers.Values)
{ {
var varType = storageBuffers.Type.Fields[0].Type & ~AggregateType.Array; 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) foreach (var texture in context.Properties.Textures.Values)