From fbb4019ed5c12c4a888c7b09db648ac595366896 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 29 Jun 2021 14:32:02 -0300 Subject: Initial support for separate GPU address spaces (#2394) * Make GPU memory manager a member of GPU channel * Move physical memory instance to the memory manager, and the caches to the physical memory * PR feedback --- .../Engine/MethodUniformBufferUpdate.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/Engine/MethodUniformBufferUpdate.cs') diff --git a/Ryujinx.Graphics.Gpu/Engine/MethodUniformBufferUpdate.cs b/Ryujinx.Graphics.Gpu/Engine/MethodUniformBufferUpdate.cs index 981d2e94..1343dbe7 100644 --- a/Ryujinx.Graphics.Gpu/Engine/MethodUniformBufferUpdate.cs +++ b/Ryujinx.Graphics.Gpu/Engine/MethodUniformBufferUpdate.cs @@ -16,11 +16,12 @@ namespace Ryujinx.Graphics.Gpu.Engine /// /// Flushes any queued ubo updates. /// - private void FlushUboDirty() + /// GPU memory manager where the uniform buffer is mapped + private void FlushUboDirty(MemoryManager memoryManager) { if (_ubFollowUpAddress != 0) { - BufferCache.ForceDirty(_ubFollowUpAddress - _ubByteCount, _ubByteCount); + memoryManager.Physical.BufferCache.ForceDirty(memoryManager, _ubFollowUpAddress - _ubByteCount, _ubByteCount); _ubFollowUpAddress = 0; } @@ -39,13 +40,14 @@ namespace Ryujinx.Graphics.Gpu.Engine if (_ubFollowUpAddress != address) { - FlushUboDirty(); + FlushUboDirty(state.Channel.MemoryManager); _ubByteCount = 0; - _ubBeginCpuAddress = _context.MemoryManager.Translate(address); + _ubBeginCpuAddress = state.Channel.MemoryManager.Translate(address); } - _context.PhysicalMemory.WriteUntracked(_ubBeginCpuAddress + _ubByteCount, MemoryMarshal.Cast(MemoryMarshal.CreateSpan(ref argument, 1))); + var byteData = MemoryMarshal.Cast(MemoryMarshal.CreateSpan(ref argument, 1)); + state.Channel.MemoryManager.Physical.WriteUntracked(_ubBeginCpuAddress + _ubByteCount, byteData); _ubFollowUpAddress = address + 4; _ubByteCount += 4; @@ -68,13 +70,14 @@ namespace Ryujinx.Graphics.Gpu.Engine if (_ubFollowUpAddress != address) { - FlushUboDirty(); + FlushUboDirty(state.Channel.MemoryManager); _ubByteCount = 0; - _ubBeginCpuAddress = _context.MemoryManager.Translate(address); + _ubBeginCpuAddress = state.Channel.MemoryManager.Translate(address); } - _context.PhysicalMemory.WriteUntracked(_ubBeginCpuAddress + _ubByteCount, MemoryMarshal.Cast(data)); + var byteData = MemoryMarshal.Cast(data); + state.Channel.MemoryManager.Physical.WriteUntracked(_ubBeginCpuAddress + _ubByteCount, byteData); _ubFollowUpAddress = address + size; _ubByteCount += size; -- cgit v1.2.3