diff options
| author | gdk <gab.dark.100@gmail.com> | 2019-11-23 02:17:22 -0300 |
|---|---|---|
| committer | Thog <thog@protonmail.com> | 2020-01-09 02:13:00 +0100 |
| commit | b2b2e046696e9c187cd9d7d4e3e92dc521082fe5 (patch) | |
| tree | a3354f5b2e50f9cefeb7c77330f40fa4db8be46a /Ryujinx.Graphics.Gpu/Memory/BufferManager.cs | |
| parent | 3ac023bb607eb630e86859cba0d3ebac55f4257a (diff) | |
Small optimizations on texture and sampler pool invalidation
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Memory/BufferManager.cs')
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Memory/BufferManager.cs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs b/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs index 78b7bc98..30bd1302 100644 --- a/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs +++ b/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs @@ -3,7 +3,6 @@ using Ryujinx.Graphics.GAL.InputAssembler; using Ryujinx.Graphics.Gpu.State; using Ryujinx.Graphics.Shader; using System; -using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Gpu.Memory { @@ -48,6 +47,7 @@ namespace Ryujinx.Graphics.Gpu.Memory private bool _indexBufferDirty; private bool _vertexBuffersDirty; + private uint _vertexBuffersEnableMask; private bool _rebind; @@ -93,6 +93,15 @@ namespace Ryujinx.Graphics.Gpu.Memory _vertexBuffers[index].Divisor = divisor; _vertexBuffersDirty = true; + + if (address != 0) + { + _vertexBuffersEnableMask |= 1u << index; + } + else + { + _vertexBuffersEnableMask &= ~(1u << index); + } } public void SetComputeStorageBuffer(int index, ulong gpuVa, ulong size) @@ -322,13 +331,15 @@ namespace Ryujinx.Graphics.Gpu.Memory SynchronizeBufferRange(_indexBuffer.Address, _indexBuffer.Size); } + uint vbEnableMask = _vertexBuffersEnableMask; + if (_vertexBuffersDirty || _rebind) { _vertexBuffersDirty = false; VertexBufferDescriptor[] vertexBuffers = new VertexBufferDescriptor[Constants.TotalVertexBuffers]; - for (int index = 0; index < Constants.TotalVertexBuffers; index++) + for (int index = 0; (vbEnableMask >> index) != 0; index++) { VertexBuffer vb = _vertexBuffers[index]; @@ -346,7 +357,7 @@ namespace Ryujinx.Graphics.Gpu.Memory } else { - for (int index = 0; index < Constants.TotalVertexBuffers; index++) + for (int index = 0; (vbEnableMask >> index) != 0; index++) { VertexBuffer vb = _vertexBuffers[index]; |
