aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Engine/MethodUniformBufferUpdate.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-06-29 14:32:02 -0300
committerGitHub <noreply@github.com>2021-06-29 19:32:02 +0200
commitfbb4019ed5c12c4a888c7b09db648ac595366896 (patch)
treea8be6bf5fc4f8b844683f1ef2ade588f3bb9bb0a /Ryujinx.Graphics.Gpu/Engine/MethodUniformBufferUpdate.cs
parent8cc872fb60ec1b825655ba8dba06cc978fcd7e66 (diff)
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
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/MethodUniformBufferUpdate.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/MethodUniformBufferUpdate.cs19
1 files changed, 11 insertions, 8 deletions
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
/// <summary>
/// Flushes any queued ubo updates.
/// </summary>
- private void FlushUboDirty()
+ /// <param name="memoryManager">GPU memory manager where the uniform buffer is mapped</param>
+ 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<int, byte>(MemoryMarshal.CreateSpan(ref argument, 1)));
+ var byteData = MemoryMarshal.Cast<int, byte>(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<int, byte>(data));
+ var byteData = MemoryMarshal.Cast<int, byte>(data);
+ state.Channel.MemoryManager.Physical.WriteUntracked(_ubBeginCpuAddress + _ubByteCount, byteData);
_ubFollowUpAddress = address + size;
_ubByteCount += size;