aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-07-07 20:56:06 -0300
committerGitHub <noreply@github.com>2021-07-07 20:56:06 -0300
commit8b44eb1c981d7106be37107755c7c71c3c3c0ce4 (patch)
tree70c3a8d7286d827941c41dee2ec3cb3273c1e6d7 /Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs
parent31cbd09a75a9d5f4814c3907a060e0961eb2bb15 (diff)
Separate GPU engines and make state follow official docs (part 1/2) (#2422)
* Use DeviceState for compute and i2m * Migrate 2D class, more comments * Migrate DMA copy engine * Remove now unused code * Replace GpuState by GpuAccessorState on GpuAcessor, since compute no longer has a GpuState * More comments * Add logging (disabled) * Add back i2m on 3D engine
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs38
1 files changed, 27 insertions, 11 deletions
diff --git a/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs b/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs
index 62368c1c..7fb979f4 100644
--- a/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs
+++ b/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs
@@ -1,6 +1,5 @@
using Ryujinx.Common.Logging;
using Ryujinx.Graphics.GAL;
-using Ryujinx.Graphics.Gpu.State;
using Ryujinx.Graphics.Shader;
namespace Ryujinx.Graphics.Gpu.Shader
@@ -11,7 +10,8 @@ namespace Ryujinx.Graphics.Gpu.Shader
class GpuAccessor : TextureDescriptorCapableGpuAccessor, IGpuAccessor
{
private readonly GpuContext _context;
- private readonly GpuState _state;
+ private readonly GpuChannel _channel;
+ private readonly GpuAccessorState _state;
private readonly int _stageIndex;
private readonly bool _compute;
private readonly int _localSizeX;
@@ -24,11 +24,13 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// Creates a new instance of the GPU state accessor for graphics shader translation.
/// </summary>
/// <param name="context">GPU context</param>
+ /// <param name="channel">GPU channel</param>
/// <param name="state">Current GPU state</param>
/// <param name="stageIndex">Graphics shader stage index (0 = Vertex, 4 = Fragment)</param>
- public GpuAccessor(GpuContext context, GpuState state, int stageIndex)
+ public GpuAccessor(GpuContext context, GpuChannel channel, GpuAccessorState state, int stageIndex)
{
_context = context;
+ _channel = channel;
_state = state;
_stageIndex = stageIndex;
}
@@ -37,6 +39,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// Creates a new instance of the GPU state accessor for compute shader translation.
/// </summary>
/// <param name="context">GPU context</param>
+ /// <param name="channel">GPU channel</param>
/// <param name="state">Current GPU state</param>
/// <param name="localSizeX">Local group size X of the compute shader</param>
/// <param name="localSizeY">Local group size Y of the compute shader</param>
@@ -45,7 +48,8 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// <param name="sharedMemorySize">Shared memory size of the compute shader</param>
public GpuAccessor(
GpuContext context,
- GpuState state,
+ GpuChannel channel,
+ GpuAccessorState state,
int localSizeX,
int localSizeY,
int localSizeZ,
@@ -53,6 +57,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
int sharedMemorySize)
{
_context = context;
+ _channel = channel;
_state = state;
_compute = true;
_localSizeX = localSizeX;
@@ -79,7 +84,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// <returns>Data at the memory location</returns>
public override T MemoryRead<T>(ulong address)
{
- return _state.Channel.MemoryManager.Read<T>(address);
+ return _channel.MemoryManager.Read<T>(address);
}
/// <summary>
@@ -89,7 +94,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// <returns>True if the address is mapped, false otherwise</returns>
public bool MemoryMapped(ulong address)
{
- return _state.Channel.MemoryManager.IsMapped(address);
+ return _channel.MemoryManager.IsMapped(address);
}
/// <summary>
@@ -129,8 +134,8 @@ namespace Ryujinx.Graphics.Gpu.Shader
public uint QueryConstantBufferUse()
{
return _compute
- ? _state.Channel.BufferManager.GetComputeUniformBufferUseMask()
- : _state.Channel.BufferManager.GetGraphicsUniformBufferUseMask(_stageIndex);
+ ? _channel.BufferManager.GetComputeUniformBufferUseMask()
+ : _channel.BufferManager.GetGraphicsUniformBufferUseMask(_stageIndex);
}
/// <summary>
@@ -196,11 +201,22 @@ namespace Ryujinx.Graphics.Gpu.Shader
{
if (_compute)
{
- return _state.Channel.TextureManager.GetComputeTextureDescriptor(_state, handle, cbufSlot);
+ return _channel.TextureManager.GetComputeTextureDescriptor(
+ _state.TexturePoolGpuVa,
+ _state.TextureBufferIndex,
+ _state.TexturePoolMaximumId,
+ handle,
+ cbufSlot);
}
else
{
- return _state.Channel.TextureManager.GetGraphicsTextureDescriptor(_state, _stageIndex, handle, cbufSlot);
+ return _channel.TextureManager.GetGraphicsTextureDescriptor(
+ _state.TexturePoolGpuVa,
+ _state.TextureBufferIndex,
+ _state.TexturePoolMaximumId,
+ _stageIndex,
+ handle,
+ cbufSlot);
}
}
@@ -210,7 +226,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// <returns>True if early depth testing is forced</returns>
public bool QueryEarlyZForce()
{
- return _state.Get<bool>(MethodOffset.EarlyZForce);
+ return _state.EarlyZForce;
}
}
}