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
This commit is contained in:
gdkchan 2021-06-23 20:51:41 -03:00 committed by GitHub
parent 12a7a2ead8
commit a10b2c5ff2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 1745 additions and 1456 deletions

View file

@ -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
/// </summary>
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];
@ -221,6 +230,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>