From a10b2c5ff26886e9ffc6f19e3f0fe9505a503b2f Mon Sep 17 00:00:00 2001 From: gdkchan Date: Wed, 23 Jun 2021 20:51:41 -0300 Subject: Initial support for GPU channels (#2372) * Ground work for separate GPU channels * Rename TextureManager to TextureCache * Decouple texture bindings management from the texture cache * Rename BufferManager to BufferCache * Decouple buffer bindings management from the buffer cache * More comments and proper disposal * PR feedback * Force host state update on channel switch * Typo * PR feedback * Missing using --- Ryujinx.Graphics.Gpu/State/GpuState.cs | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/State') diff --git a/Ryujinx.Graphics.Gpu/State/GpuState.cs b/Ryujinx.Graphics.Gpu/State/GpuState.cs index 16dad5c1..ff4d7829 100644 --- a/Ryujinx.Graphics.Gpu/State/GpuState.cs +++ b/Ryujinx.Graphics.Gpu/State/GpuState.cs @@ -1,4 +1,5 @@ -using System; +using Ryujinx.Graphics.Gpu.Image; +using System; using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Gpu.State @@ -37,11 +38,19 @@ namespace Ryujinx.Graphics.Gpu.State /// public ShadowRamControl ShadowRamControl { get; set; } + /// + /// GPU channel for the sub-channel state. + /// + public GpuChannel Channel { get; } + /// /// Creates a new instance of the GPU state. /// - public GpuState() + /// Channel that the sub-channel state belongs to + public GpuState(GpuChannel channel) { + Channel = channel; + _memory = new int[RegistersCount]; _shadow = new int[RegistersCount]; @@ -221,6 +230,21 @@ namespace Ryujinx.Graphics.Gpu.State } } + /// + /// Forces a full host state update by marking all state as modified, + /// and also requests all GPU resources in use to be rebound. + /// + public void ForceAllDirty() + { + for (int index = 0; index < _registers.Length; index++) + { + _registers[index].Modified = true; + } + + Channel.BufferManager.Rebind(); + Channel.TextureManager.Rebind(); + } + /// /// Checks if a given register has been modified since the last call to this method. /// -- cgit v1.2.3