diff options
author | gdkchan <gab.dark.100@gmail.com> | 2023-05-20 13:15:07 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-20 16:15:07 +0000 |
commit | fb27042e01b0fa110184673d436ec96ec8cf20c7 (patch) | |
tree | 7b36f237e5b022b41a48e352074e9cdc6651e785 /src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs | |
parent | 69a9de33d37de03693a4a4f6f51aead63b0c6334 (diff) |
Limit compute storage buffer size (#5028)1.1.810
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs')
-rw-r--r-- | src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs index 4ec23c79..998ece22 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs @@ -162,7 +162,19 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute SbDescriptor sbDescriptor = _channel.MemoryManager.Physical.Read<SbDescriptor>(sbDescAddress); - _channel.BufferManager.SetComputeStorageBuffer(sb.Slot, sbDescriptor.PackAddress(), (uint)sbDescriptor.Size, sb.Flags); + uint size; + if (sb.SbCbSlot == Constants.DriverReservedUniformBuffer) + { + // Only trust the SbDescriptor size if it comes from slot 0. + size = (uint)sbDescriptor.Size; + } + else + { + // TODO: Use full mapped size and somehow speed up buffer sync. + size = (uint)_channel.MemoryManager.GetMappedSize(sbDescriptor.PackAddress(), Constants.MaxUnknownStorageSize); + } + + _channel.BufferManager.SetComputeStorageBuffer(sb.Slot, sbDescriptor.PackAddress(), size, sb.Flags); } if ((_channel.BufferManager.HasUnalignedStorageBuffers) != hasUnaligned) |