|
|
@@ -23,6 +23,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|
|
public const int PrimitiveRestartStateIndex = 12;
|
|
|
public const int RenderTargetStateIndex = 27;
|
|
|
|
|
|
+ private const ulong MaxUnknownStorageSize = 0x100000;
|
|
|
+
|
|
|
private readonly GpuContext _context;
|
|
|
private readonly GpuChannel _channel;
|
|
|
private readonly DeviceStateWithShadow<ThreedClassState> _state;
|
|
|
@@ -356,7 +358,19 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|
|
|
|
|
SbDescriptor sbDescriptor = _channel.MemoryManager.Physical.Read<SbDescriptor>(sbDescAddress);
|
|
|
|
|
|
- _channel.BufferManager.SetGraphicsStorageBuffer(stage, sb.Slot, sbDescriptor.PackAddress(), (uint)sbDescriptor.Size, sb.Flags);
|
|
|
+ uint size;
|
|
|
+ if (sb.SbCbSlot == 0)
|
|
|
+ {
|
|
|
+ // 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(), MaxUnknownStorageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ _channel.BufferManager.SetGraphicsStorageBuffer(stage, sb.Slot, sbDescriptor.PackAddress(), size, sb.Flags);
|
|
|
}
|
|
|
}
|
|
|
}
|