From 8cba252b238ee6cf6599ad2fc57793e6f76c5e2e Mon Sep 17 00:00:00 2001 From: gdk Date: Sat, 26 Oct 2019 14:50:52 -0300 Subject: Add per-source type memory change tracking, simplified state change tracking, other fixes --- Ryujinx.Graphics.Gpu/Memory/Buffer.cs | 2 +- Ryujinx.Graphics.Gpu/Memory/BufferManager.cs | 8 ++++++-- Ryujinx.Graphics.Gpu/Memory/IPhysicalMemory.cs | 2 +- Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs | 2 +- Ryujinx.Graphics.Gpu/Memory/ResourceName.cs | 10 ++++++++++ 5 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 Ryujinx.Graphics.Gpu/Memory/ResourceName.cs (limited to 'Ryujinx.Graphics.Gpu/Memory') diff --git a/Ryujinx.Graphics.Gpu/Memory/Buffer.cs b/Ryujinx.Graphics.Gpu/Memory/Buffer.cs index 30bd1ac0..6f904d0f 100644 --- a/Ryujinx.Graphics.Gpu/Memory/Buffer.cs +++ b/Ryujinx.Graphics.Gpu/Memory/Buffer.cs @@ -69,7 +69,7 @@ namespace Ryujinx.Graphics.Gpu.Memory return; } - (ulong, ulong)[] modifiedRanges = _context.PhysicalMemory.GetModifiedRanges(address, size); + (ulong, ulong)[] modifiedRanges = _context.PhysicalMemory.GetModifiedRanges(address, size, ResourceName.Buffer); for (int index = 0; index < modifiedRanges.Length; index++) { diff --git a/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs b/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs index 3ceee206..6d7fab68 100644 --- a/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs +++ b/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs @@ -116,9 +116,13 @@ namespace Ryujinx.Graphics.Gpu.Memory ulong address = TranslateAndCreateBuffer(gpuVa, size); - _gpStorageBuffers[stage].Bind(index, address, size); + if (_gpStorageBuffers[stage].Buffers[index].Address != address || + _gpStorageBuffers[stage].Buffers[index].Size != size) + { + _gpStorageBuffersDirty = true; + } - _gpStorageBuffersDirty = true; + _gpStorageBuffers[stage].Bind(index, address, size); } public void SetComputeUniformBuffer(int index, ulong gpuVa, ulong size) diff --git a/Ryujinx.Graphics.Gpu/Memory/IPhysicalMemory.cs b/Ryujinx.Graphics.Gpu/Memory/IPhysicalMemory.cs index 5f21704d..73b3a9e1 100644 --- a/Ryujinx.Graphics.Gpu/Memory/IPhysicalMemory.cs +++ b/Ryujinx.Graphics.Gpu/Memory/IPhysicalMemory.cs @@ -10,6 +10,6 @@ namespace Ryujinx.Graphics.Gpu.Memory void Write(ulong address, Span data); - (ulong, ulong)[] GetModifiedRanges(ulong address, ulong size); + (ulong, ulong)[] GetModifiedRanges(ulong address, ulong size, ResourceName name); } } \ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs b/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs index d1a3e69c..59319a47 100644 --- a/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs +++ b/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs @@ -8,7 +8,7 @@ namespace Ryujinx.Graphics.Gpu.Memory private const int PtLvl0Bits = 14; private const int PtLvl1Bits = 14; - private const int PtPageBits = 12; + public const int PtPageBits = 12; private const ulong PtLvl0Size = 1UL << PtLvl0Bits; private const ulong PtLvl1Size = 1UL << PtLvl1Bits; diff --git a/Ryujinx.Graphics.Gpu/Memory/ResourceName.cs b/Ryujinx.Graphics.Gpu/Memory/ResourceName.cs new file mode 100644 index 00000000..9476a384 --- /dev/null +++ b/Ryujinx.Graphics.Gpu/Memory/ResourceName.cs @@ -0,0 +1,10 @@ +namespace Ryujinx.Graphics.Gpu.Memory +{ + public enum ResourceName + { + Buffer, + Texture, + TexturePool, + SamplerPool + } +} \ No newline at end of file -- cgit v1.2.3