aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/State
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-06-23 20:51:41 -0300
committerGitHub <noreply@github.com>2021-06-24 01:51:41 +0200
commita10b2c5ff26886e9ffc6f19e3f0fe9505a503b2f (patch)
tree006d013c300fb56c94c5563c2c1409a189f794b2 /Ryujinx.Graphics.Gpu/State
parent12a7a2ead812d46deb9d978b6758731157be1cbc (diff)
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
Diffstat (limited to 'Ryujinx.Graphics.Gpu/State')
-rw-r--r--Ryujinx.Graphics.Gpu/State/GpuState.cs28
1 files changed, 26 insertions, 2 deletions
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
@@ -38,10 +39,18 @@ namespace Ryujinx.Graphics.Gpu.State
public ShadowRamControl ShadowRamControl { get; set; }
/// <summary>
+ /// GPU channel for the sub-channel state.
+ /// </summary>
+ public GpuChannel Channel { get; }
+
+ /// <summary>
/// Creates a new instance of the GPU state.
/// </summary>
- public GpuState()
+ /// <param name="channel">Channel that the sub-channel state belongs to</param>
+ public GpuState(GpuChannel channel)
{
+ Channel = channel;
+
_memory = new int[RegistersCount];
_shadow = new int[RegistersCount];
@@ -222,6 +231,21 @@ namespace Ryujinx.Graphics.Gpu.State
}
/// <summary>
+ /// Forces a full host state update by marking all state as modified,
+ /// and also requests all GPU resources in use to be rebound.
+ /// </summary>
+ public void ForceAllDirty()
+ {
+ for (int index = 0; index < _registers.Length; index++)
+ {
+ _registers[index].Modified = true;
+ }
+
+ Channel.BufferManager.Rebind();
+ Channel.TextureManager.Rebind();
+ }
+
+ /// <summary>
/// Checks if a given register has been modified since the last call to this method.
/// </summary>
/// <param name="offset">Register offset</param>