Add per-source type memory change tracking, simplified state change tracking, other fixes
This commit is contained in:
parent
1b7d955195
commit
8cba252b23
40 changed files with 494 additions and 668 deletions
|
@ -4,12 +4,13 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
{
|
||||
struct BlendState
|
||||
{
|
||||
public Bool SeparateAlpha;
|
||||
public Boolean32 SeparateAlpha;
|
||||
public BlendOp ColorOp;
|
||||
public BlendFactor ColorSrcFactor;
|
||||
public BlendFactor ColorDstFactor;
|
||||
public BlendOp AlphaOp;
|
||||
public BlendFactor AlphaSrcFactor;
|
||||
public BlendFactor AlphaDstFactor;
|
||||
public uint Padding;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
namespace Ryujinx.Graphics.Gpu.State
|
||||
{
|
||||
struct Bool
|
||||
{
|
||||
private uint _value;
|
||||
|
||||
public bool IsTrue()
|
||||
{
|
||||
return (_value & 1) != 0;
|
||||
}
|
||||
|
||||
public bool IsFalse()
|
||||
{
|
||||
return (_value & 1) == 0;
|
||||
}
|
||||
}
|
||||
}
|
12
Ryujinx.Graphics.Gpu/State/Boolean32.cs
Normal file
12
Ryujinx.Graphics.Gpu/State/Boolean32.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace Ryujinx.Graphics.Gpu.State
|
||||
{
|
||||
struct Boolean32
|
||||
{
|
||||
private uint _value;
|
||||
|
||||
public static implicit operator bool(Boolean32 value)
|
||||
{
|
||||
return (value._value & 1) != 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
struct CopyTexture
|
||||
{
|
||||
public RtFormat Format;
|
||||
public bool LinearLayout;
|
||||
public Boolean32 LinearLayout;
|
||||
public MemoryLayout MemoryLayout;
|
||||
public int Depth;
|
||||
public int Layer;
|
||||
|
|
|
@ -2,8 +2,8 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
{
|
||||
struct DepthBiasState
|
||||
{
|
||||
public Bool PointEnable;
|
||||
public Bool LineEnable;
|
||||
public Bool FillEnable;
|
||||
public Boolean32 PointEnable;
|
||||
public Boolean32 LineEnable;
|
||||
public Boolean32 FillEnable;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
{
|
||||
struct FaceState
|
||||
{
|
||||
public Bool CullEnable;
|
||||
public Boolean32 CullEnable;
|
||||
public FrontFace FrontFace;
|
||||
public Face CullFace;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using Ryujinx.Graphics.GAL;
|
||||
using Ryujinx.Graphics.Gpu.Image;
|
||||
using System;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Ryujinx.Graphics.Gpu.State
|
||||
|
@ -17,39 +15,54 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
{
|
||||
public MethodCallback Callback;
|
||||
|
||||
public StateWriteFlags WriteFlag;
|
||||
public MethodOffset BaseOffset;
|
||||
|
||||
public int Stride;
|
||||
public int Count;
|
||||
|
||||
public bool Modified;
|
||||
}
|
||||
|
||||
private Register[] _registers;
|
||||
|
||||
public StateWriteFlags StateWriteFlags { get; set; }
|
||||
|
||||
public GpuState()
|
||||
{
|
||||
_backingMemory = new int[RegistersCount];
|
||||
|
||||
_registers = new Register[RegistersCount];
|
||||
|
||||
StateWriteFlags = StateWriteFlags.Any;
|
||||
for (int index = 0; index < _registers.Length; index++)
|
||||
{
|
||||
_registers[index].BaseOffset = (MethodOffset)index;
|
||||
_registers[index].Stride = 1;
|
||||
_registers[index].Count = 1;
|
||||
_registers[index].Modified = true;
|
||||
}
|
||||
|
||||
foreach (var item in GpuStateTable.Table)
|
||||
{
|
||||
int totalRegs = item.Size * item.Count;
|
||||
|
||||
for (int regOffset = 0; regOffset < totalRegs; regOffset++)
|
||||
{
|
||||
int index = (int)item.Offset + regOffset;
|
||||
|
||||
_registers[index].BaseOffset = item.Offset;
|
||||
_registers[index].Stride = item.Size;
|
||||
_registers[index].Count = item.Count;
|
||||
}
|
||||
}
|
||||
|
||||
InitializeDefaultState();
|
||||
InitializeStateWatchers();
|
||||
}
|
||||
|
||||
public bool ExitEarly;
|
||||
|
||||
public void CallMethod(MethodParams meth)
|
||||
{
|
||||
if (ExitEarly)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Register register = _registers[meth.Method];
|
||||
|
||||
if (_backingMemory[meth.Method] != meth.Argument)
|
||||
{
|
||||
StateWriteFlags |= register.WriteFlag;
|
||||
_registers[(int)register.BaseOffset].Modified = true;
|
||||
}
|
||||
|
||||
_backingMemory[meth.Method] = meth.Argument;
|
||||
|
@ -67,264 +80,11 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
return _backingMemory[offset];
|
||||
}
|
||||
|
||||
public void RegisterCopyBufferCallback(MethodCallback callback)
|
||||
{
|
||||
RegisterCallback(0xc0, callback);
|
||||
}
|
||||
|
||||
public void RegisterCopyTextureCallback(MethodCallback callback)
|
||||
{
|
||||
RegisterCallback(0x237, callback);
|
||||
}
|
||||
|
||||
public void RegisterDrawEndCallback(MethodCallback callback)
|
||||
{
|
||||
RegisterCallback(0x585, callback);
|
||||
}
|
||||
|
||||
public void RegisterDrawBeginCallback(MethodCallback callback)
|
||||
{
|
||||
RegisterCallback(0x586, callback);
|
||||
}
|
||||
|
||||
public void RegisterSetIndexCountCallback(MethodCallback callback)
|
||||
{
|
||||
RegisterCallback(0x5f8, callback);
|
||||
}
|
||||
|
||||
public void RegisterClearCallback(MethodCallback callback)
|
||||
{
|
||||
RegisterCallback(0x674, callback);
|
||||
}
|
||||
|
||||
public void RegisterReportCallback(MethodCallback callback)
|
||||
{
|
||||
RegisterCallback(0x6c3, callback);
|
||||
}
|
||||
|
||||
public void RegisterUniformBufferUpdateCallback(MethodCallback callback)
|
||||
{
|
||||
for (int index = 0; index < 16; index++)
|
||||
{
|
||||
RegisterCallback(0x8e4 + index, callback);
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterUniformBufferBind0Callback(MethodCallback callback)
|
||||
{
|
||||
RegisterCallback(0x904, callback);
|
||||
}
|
||||
|
||||
public void RegisterUniformBufferBind1Callback(MethodCallback callback)
|
||||
{
|
||||
RegisterCallback(0x90c, callback);
|
||||
}
|
||||
|
||||
public void RegisterUniformBufferBind2Callback(MethodCallback callback)
|
||||
{
|
||||
RegisterCallback(0x914, callback);
|
||||
}
|
||||
|
||||
public void RegisterUniformBufferBind3Callback(MethodCallback callback)
|
||||
{
|
||||
RegisterCallback(0x91c, callback);
|
||||
}
|
||||
|
||||
public void RegisterUniformBufferBind4Callback(MethodCallback callback)
|
||||
{
|
||||
RegisterCallback(0x924, callback);
|
||||
}
|
||||
|
||||
public CopyTexture GetCopyDstTexture()
|
||||
{
|
||||
return Get<CopyTexture>(MethodOffset.CopyDstTexture);
|
||||
}
|
||||
|
||||
public CopyTexture GetCopySrcTexture()
|
||||
{
|
||||
return Get<CopyTexture>(MethodOffset.CopySrcTexture);
|
||||
}
|
||||
|
||||
public RtColorState GetRtColorState(int index)
|
||||
{
|
||||
return Get<RtColorState>(MethodOffset.RtColorState + 16 * index);
|
||||
}
|
||||
|
||||
public CopyTextureControl GetCopyTextureControl()
|
||||
{
|
||||
return Get<CopyTextureControl>(MethodOffset.CopyTextureControl);
|
||||
}
|
||||
|
||||
public CopyRegion GetCopyRegion()
|
||||
{
|
||||
return Get<CopyRegion>(MethodOffset.CopyRegion);
|
||||
}
|
||||
|
||||
public ViewportTransform GetViewportTransform(int index)
|
||||
{
|
||||
return Get<ViewportTransform>(MethodOffset.ViewportTransform + 8 * index);
|
||||
}
|
||||
|
||||
public ViewportExtents GetViewportExtents(int index)
|
||||
{
|
||||
return Get<ViewportExtents>(MethodOffset.ViewportExtents + 4 * index);
|
||||
}
|
||||
|
||||
public VertexBufferDrawState GetVertexBufferDrawState()
|
||||
{
|
||||
return Get<VertexBufferDrawState>(MethodOffset.VertexBufferDrawState);
|
||||
}
|
||||
|
||||
public ClearColors GetClearColors()
|
||||
{
|
||||
return Get<ClearColors>(MethodOffset.ClearColors);
|
||||
}
|
||||
|
||||
public float GetClearDepthValue()
|
||||
{
|
||||
return Get<float>(MethodOffset.ClearDepthValue);
|
||||
}
|
||||
|
||||
public int GetClearStencilValue()
|
||||
{
|
||||
return _backingMemory[(int)MethodOffset.ClearStencilValue];
|
||||
}
|
||||
|
||||
public StencilBackMasks GetStencilBackMasks()
|
||||
{
|
||||
return Get<StencilBackMasks>(MethodOffset.StencilBackMasks);
|
||||
}
|
||||
|
||||
public RtDepthStencilState GetRtDepthStencilState()
|
||||
{
|
||||
return Get<RtDepthStencilState>(MethodOffset.RtDepthStencilState);
|
||||
}
|
||||
|
||||
public VertexAttribState GetVertexAttribState(int index)
|
||||
{
|
||||
return Get<VertexAttribState>(MethodOffset.VertexAttribState + index);
|
||||
}
|
||||
|
||||
public Size3D GetRtDepthStencilSize()
|
||||
{
|
||||
return Get<Size3D>(MethodOffset.RtDepthStencilSize);
|
||||
}
|
||||
|
||||
public Bool GetDepthTestEnable()
|
||||
{
|
||||
return Get<Bool>(MethodOffset.DepthTestEnable);
|
||||
}
|
||||
|
||||
public CompareOp GetDepthTestFunc()
|
||||
{
|
||||
return Get<CompareOp>(MethodOffset.DepthTestFunc);
|
||||
}
|
||||
|
||||
public Bool GetDepthWriteEnable()
|
||||
{
|
||||
return Get<Bool>(MethodOffset.DepthWriteEnable);
|
||||
}
|
||||
|
||||
public Bool GetBlendEnable(int index)
|
||||
{
|
||||
return Get<Bool>(MethodOffset.BlendEnable + index);
|
||||
}
|
||||
|
||||
public StencilTestState GetStencilTestState()
|
||||
{
|
||||
return Get<StencilTestState>(MethodOffset.StencilTestState);
|
||||
}
|
||||
|
||||
public int GetBaseVertex()
|
||||
{
|
||||
return _backingMemory[(int)MethodOffset.FirstVertex];
|
||||
}
|
||||
|
||||
public int GetBaseInstance()
|
||||
{
|
||||
return _backingMemory[(int)MethodOffset.FirstInstance];
|
||||
}
|
||||
|
||||
public PoolState GetSamplerPoolState()
|
||||
{
|
||||
return Get<PoolState>(MethodOffset.SamplerPoolState);
|
||||
}
|
||||
|
||||
public PoolState GetTexturePoolState()
|
||||
{
|
||||
return Get<PoolState>(MethodOffset.TexturePoolState);
|
||||
}
|
||||
|
||||
public StencilBackTestState GetStencilBackTestState()
|
||||
{
|
||||
return Get<StencilBackTestState>(MethodOffset.StencilBackTestState);
|
||||
}
|
||||
|
||||
public TextureMsaaMode GetRtMsaaMode()
|
||||
{
|
||||
return Get<TextureMsaaMode>(MethodOffset.RtMsaaMode);
|
||||
}
|
||||
|
||||
public GpuVa GetShaderBaseAddress()
|
||||
{
|
||||
return Get<GpuVa>(MethodOffset.ShaderBaseAddress);
|
||||
}
|
||||
|
||||
public PrimitiveRestartState GetPrimitiveRestartState()
|
||||
{
|
||||
return Get<PrimitiveRestartState>(MethodOffset.PrimitiveRestartState);
|
||||
}
|
||||
|
||||
public IndexBufferState GetIndexBufferState()
|
||||
{
|
||||
return Get<IndexBufferState>(MethodOffset.IndexBufferState);
|
||||
}
|
||||
|
||||
public FaceState GetFaceState()
|
||||
{
|
||||
return Get<FaceState>(MethodOffset.FaceState);
|
||||
}
|
||||
|
||||
public ReportState GetReportState()
|
||||
{
|
||||
return Get<ReportState>(MethodOffset.ReportState);
|
||||
}
|
||||
|
||||
public VertexBufferState GetVertexBufferState(int index)
|
||||
{
|
||||
return Get<VertexBufferState>(MethodOffset.VertexBufferState + 4 * index);
|
||||
}
|
||||
|
||||
public BlendState GetBlendState(int index)
|
||||
{
|
||||
return Get<BlendState>(MethodOffset.BlendState + 8 * index);
|
||||
}
|
||||
|
||||
public GpuVa GetVertexBufferEndAddress(int index)
|
||||
{
|
||||
return Get<GpuVa>(MethodOffset.VertexBufferEndAddress + 2 * index);
|
||||
}
|
||||
|
||||
public ShaderState GetShaderState(int index)
|
||||
{
|
||||
return Get<ShaderState>(MethodOffset.ShaderState + 16 * index);
|
||||
}
|
||||
|
||||
public UniformBufferState GetUniformBufferState()
|
||||
{
|
||||
return Get<UniformBufferState>(MethodOffset.UniformBufferState);
|
||||
}
|
||||
|
||||
public void SetUniformBufferOffset(int offset)
|
||||
{
|
||||
_backingMemory[(int)MethodOffset.UniformBufferState + 3] = offset;
|
||||
}
|
||||
|
||||
public int GetTextureBufferIndex()
|
||||
{
|
||||
return _backingMemory[(int)MethodOffset.TextureBufferIndex];
|
||||
}
|
||||
|
||||
private void InitializeDefaultState()
|
||||
{
|
||||
// Depth ranges.
|
||||
|
@ -341,69 +101,11 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
_backingMemory[(int)MethodOffset.RtColorMask] = 0x1111;
|
||||
}
|
||||
|
||||
private void InitializeStateWatchers()
|
||||
public void RegisterCallback(MethodOffset offset, int count, MethodCallback callback)
|
||||
{
|
||||
SetWriteStateFlag(MethodOffset.RtColorState, StateWriteFlags.RtColorState, 16 * 8);
|
||||
|
||||
SetWriteStateFlag(MethodOffset.ViewportTransform, StateWriteFlags.ViewportTransform, 8 * 8);
|
||||
SetWriteStateFlag(MethodOffset.ViewportExtents, StateWriteFlags.ViewportTransform, 4 * 8);
|
||||
|
||||
SetWriteStateFlag<VertexBufferDrawState>(MethodOffset.VertexBufferDrawState, StateWriteFlags.VertexBufferState);
|
||||
|
||||
SetWriteStateFlag<DepthBiasState>(MethodOffset.DepthBiasState, StateWriteFlags.DepthBiasState);
|
||||
|
||||
SetWriteStateFlag(MethodOffset.DepthBiasFactor, StateWriteFlags.DepthBiasState, 1);
|
||||
SetWriteStateFlag(MethodOffset.DepthBiasUnits, StateWriteFlags.DepthBiasState, 1);
|
||||
SetWriteStateFlag(MethodOffset.DepthBiasClamp, StateWriteFlags.DepthBiasState, 1);
|
||||
|
||||
SetWriteStateFlag<RtDepthStencilState>(MethodOffset.RtDepthStencilState, StateWriteFlags.RtDepthStencilState);
|
||||
SetWriteStateFlag<Size3D> (MethodOffset.RtDepthStencilSize, StateWriteFlags.RtDepthStencilState);
|
||||
|
||||
SetWriteStateFlag(MethodOffset.DepthTestEnable, StateWriteFlags.DepthTestState, 1);
|
||||
SetWriteStateFlag(MethodOffset.DepthWriteEnable, StateWriteFlags.DepthTestState, 1);
|
||||
SetWriteStateFlag(MethodOffset.DepthTestFunc, StateWriteFlags.DepthTestState, 1);
|
||||
|
||||
SetWriteStateFlag(MethodOffset.VertexAttribState, StateWriteFlags.VertexAttribState, 16);
|
||||
|
||||
SetWriteStateFlag<StencilBackMasks> (MethodOffset.StencilBackMasks, StateWriteFlags.StencilTestState);
|
||||
SetWriteStateFlag<StencilTestState> (MethodOffset.StencilTestState, StateWriteFlags.StencilTestState);
|
||||
SetWriteStateFlag<StencilBackTestState>(MethodOffset.StencilBackTestState, StateWriteFlags.StencilTestState);
|
||||
|
||||
SetWriteStateFlag<PoolState>(MethodOffset.SamplerPoolState, StateWriteFlags.SamplerPoolState);
|
||||
SetWriteStateFlag<PoolState>(MethodOffset.TexturePoolState, StateWriteFlags.TexturePoolState);
|
||||
|
||||
SetWriteStateFlag<ShaderState>(MethodOffset.ShaderBaseAddress, StateWriteFlags.ShaderState);
|
||||
|
||||
SetWriteStateFlag<PrimitiveRestartState>(MethodOffset.PrimitiveRestartState, StateWriteFlags.PrimitiveRestartState);
|
||||
|
||||
SetWriteStateFlag<IndexBufferState>(MethodOffset.IndexBufferState, StateWriteFlags.IndexBufferState);
|
||||
|
||||
SetWriteStateFlag<FaceState>(MethodOffset.FaceState, StateWriteFlags.FaceState);
|
||||
|
||||
SetWriteStateFlag<RtColorMask>(MethodOffset.RtColorMask, StateWriteFlags.RtColorMask);
|
||||
|
||||
SetWriteStateFlag(MethodOffset.VertexBufferInstanced, StateWriteFlags.VertexBufferState, 16);
|
||||
SetWriteStateFlag(MethodOffset.VertexBufferState, StateWriteFlags.VertexBufferState, 4 * 16);
|
||||
SetWriteStateFlag(MethodOffset.VertexBufferEndAddress, StateWriteFlags.VertexBufferState, 2 * 16);
|
||||
|
||||
SetWriteStateFlag(MethodOffset.BlendEnable, StateWriteFlags.BlendState, 8);
|
||||
SetWriteStateFlag(MethodOffset.BlendState, StateWriteFlags.BlendState, 8 * 8);
|
||||
|
||||
SetWriteStateFlag(MethodOffset.ShaderState, StateWriteFlags.ShaderState, 16 * 6);
|
||||
|
||||
SetWriteStateFlag(MethodOffset.TextureBufferIndex, StateWriteFlags.TexturePoolState, 1);
|
||||
}
|
||||
|
||||
private void SetWriteStateFlag<T>(MethodOffset offset, StateWriteFlags flag)
|
||||
{
|
||||
SetWriteStateFlag(offset, flag, Marshal.SizeOf<T>());
|
||||
}
|
||||
|
||||
private void SetWriteStateFlag(MethodOffset offset, StateWriteFlags flag, int size)
|
||||
{
|
||||
for (int index = 0; index < size; index++)
|
||||
for (int index = 0; index < count; index++)
|
||||
{
|
||||
_registers[(int)offset + index].WriteFlag = flag;
|
||||
_registers[(int)offset + index].Callback = callback;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -412,9 +114,37 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
_registers[(int)offset].Callback = callback;
|
||||
}
|
||||
|
||||
private void RegisterCallback(int offset, MethodCallback callback)
|
||||
public bool QueryModified(params MethodOffset[] offsets)
|
||||
{
|
||||
_registers[offset].Callback = callback;
|
||||
bool modified = false;
|
||||
|
||||
for (int index = 0; index < offsets.Length; index++)
|
||||
{
|
||||
modified |= QueryModified(offsets[index]);
|
||||
}
|
||||
|
||||
return modified;
|
||||
}
|
||||
|
||||
public bool QueryModified(MethodOffset offset)
|
||||
{
|
||||
bool modified = _registers[(int)offset].Modified;
|
||||
|
||||
_registers[(int)offset].Modified = false;
|
||||
|
||||
return modified;
|
||||
}
|
||||
|
||||
public T Get<T>(MethodOffset offset, int index) where T : struct
|
||||
{
|
||||
Register register = _registers[(int)offset];
|
||||
|
||||
if ((uint)index >= register.Count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
}
|
||||
|
||||
return Get<T>(offset + index * register.Stride);
|
||||
}
|
||||
|
||||
public T Get<T>(MethodOffset offset) where T : struct
|
||||
|
|
56
Ryujinx.Graphics.Gpu/State/GpuStateTable.cs
Normal file
56
Ryujinx.Graphics.Gpu/State/GpuStateTable.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Ryujinx.Graphics.Gpu.State
|
||||
{
|
||||
static class GpuStateTable
|
||||
{
|
||||
public struct TableItem
|
||||
{
|
||||
public MethodOffset Offset { get; }
|
||||
|
||||
public int Size { get; }
|
||||
public int Count { get; }
|
||||
|
||||
public TableItem(MethodOffset offset, Type type, int count)
|
||||
{
|
||||
int sizeInBytes = Marshal.SizeOf(type);
|
||||
|
||||
Debug.Assert((sizeInBytes & 3) == 0);
|
||||
|
||||
Offset = offset;
|
||||
Size = sizeInBytes / 4;
|
||||
Count = count;
|
||||
}
|
||||
}
|
||||
|
||||
public static TableItem[] Table = new TableItem[]
|
||||
{
|
||||
new TableItem(MethodOffset.RtColorState, typeof(RtColorState), 8),
|
||||
new TableItem(MethodOffset.ViewportTransform, typeof(ViewportTransform), 8),
|
||||
new TableItem(MethodOffset.ViewportExtents, typeof(ViewportExtents), 8),
|
||||
new TableItem(MethodOffset.VertexBufferDrawState, typeof(VertexBufferDrawState), 1),
|
||||
new TableItem(MethodOffset.DepthBiasState, typeof(DepthBiasState), 1),
|
||||
new TableItem(MethodOffset.StencilBackMasks, typeof(StencilBackMasks), 1),
|
||||
new TableItem(MethodOffset.RtDepthStencilState, typeof(RtDepthStencilState), 1),
|
||||
new TableItem(MethodOffset.VertexAttribState, typeof(VertexAttribState), 16),
|
||||
new TableItem(MethodOffset.RtDepthStencilSize, typeof(Size3D), 1),
|
||||
new TableItem(MethodOffset.BlendEnable, typeof(Boolean32), 8),
|
||||
new TableItem(MethodOffset.StencilTestState, typeof(StencilTestState), 1),
|
||||
new TableItem(MethodOffset.SamplerPoolState, typeof(PoolState), 1),
|
||||
new TableItem(MethodOffset.TexturePoolState, typeof(PoolState), 1),
|
||||
new TableItem(MethodOffset.StencilBackTestState, typeof(StencilBackTestState), 1),
|
||||
new TableItem(MethodOffset.ShaderBaseAddress, typeof(GpuVa), 1),
|
||||
new TableItem(MethodOffset.PrimitiveRestartState, typeof(PrimitiveRestartState), 1),
|
||||
new TableItem(MethodOffset.IndexBufferState, typeof(IndexBufferState), 1),
|
||||
new TableItem(MethodOffset.VertexBufferInstanced, typeof(Boolean32), 16),
|
||||
new TableItem(MethodOffset.FaceState, typeof(FaceState), 1),
|
||||
new TableItem(MethodOffset.RtColorMask, typeof(RtColorMask), 8),
|
||||
new TableItem(MethodOffset.VertexBufferState, typeof(VertexBufferState), 16),
|
||||
new TableItem(MethodOffset.BlendState, typeof(BlendState), 8),
|
||||
new TableItem(MethodOffset.VertexBufferEndAddress, typeof(GpuVa), 16),
|
||||
new TableItem(MethodOffset.ShaderState, typeof(ShaderState), 6),
|
||||
};
|
||||
}
|
||||
}
|
|
@ -9,10 +9,5 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
{
|
||||
return Low | ((ulong)High << 32);
|
||||
}
|
||||
|
||||
public bool IsNullPtr()
|
||||
{
|
||||
return (Low | High) == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,63 +2,76 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
{
|
||||
enum MethodOffset
|
||||
{
|
||||
Inline2MemoryParams = 0x60,
|
||||
Inline2MemoryExecute = 0x6c,
|
||||
Inline2MemoryPushData = 0x6d,
|
||||
CopyDstTexture = 0x80,
|
||||
CopySrcTexture = 0x8c,
|
||||
DispatchParamsAddress = 0xad,
|
||||
Dispatch = 0xaf,
|
||||
CopyBufferParams = 0x100,
|
||||
CopyBufferSwizzle = 0x1c2,
|
||||
CopyBufferDstTexture = 0x1c3,
|
||||
CopyBufferSrcTexture = 0x1ca,
|
||||
RtColorState = 0x200,
|
||||
CopyTextureControl = 0x223,
|
||||
CopyRegion = 0x22c,
|
||||
ViewportTransform = 0x280,
|
||||
ViewportExtents = 0x300,
|
||||
VertexBufferDrawState = 0x35d,
|
||||
ClearColors = 0x360,
|
||||
ClearDepthValue = 0x364,
|
||||
ClearStencilValue = 0x368,
|
||||
DepthBiasState = 0x370,
|
||||
TextureBarrier = 0x378,
|
||||
StencilBackMasks = 0x3d5,
|
||||
InvalidateTextures = 0x3dd,
|
||||
TextureBarrierTiled = 0x3df,
|
||||
RtDepthStencilState = 0x3f8,
|
||||
VertexAttribState = 0x458,
|
||||
RtDepthStencilSize = 0x48a,
|
||||
DepthTestEnable = 0x4b3,
|
||||
DepthWriteEnable = 0x4ba,
|
||||
DepthTestFunc = 0x4c3,
|
||||
BlendEnable = 0x4d8,
|
||||
StencilTestState = 0x4e0,
|
||||
FirstVertex = 0x50d,
|
||||
FirstInstance = 0x50e,
|
||||
ResetCounter = 0x54c,
|
||||
RtDepthStencilEnable = 0x54e,
|
||||
ConditionState = 0x554,
|
||||
SamplerPoolState = 0x557,
|
||||
DepthBiasFactor = 0x55b,
|
||||
TexturePoolState = 0x55d,
|
||||
StencilBackTestState = 0x565,
|
||||
DepthBiasUnits = 0x56f,
|
||||
RtMsaaMode = 0x574,
|
||||
ShaderBaseAddress = 0x582,
|
||||
PrimitiveRestartState = 0x591,
|
||||
IndexBufferState = 0x5f2,
|
||||
DepthBiasClamp = 0x61f,
|
||||
VertexBufferInstanced = 0x620,
|
||||
FaceState = 0x646,
|
||||
RtColorMask = 0x680,
|
||||
ReportState = 0x6c0,
|
||||
VertexBufferState = 0x700,
|
||||
BlendState = 0x780,
|
||||
VertexBufferEndAddress = 0x7c0,
|
||||
ShaderState = 0x800,
|
||||
UniformBufferState = 0x8e0,
|
||||
TextureBufferIndex = 0x982
|
||||
I2mParams = 0x60,
|
||||
LaunchDma = 0x6c,
|
||||
LoadInlineData = 0x6d,
|
||||
CopyDstTexture = 0x80,
|
||||
CopySrcTexture = 0x8c,
|
||||
DispatchParamsAddress = 0xad,
|
||||
Dispatch = 0xaf,
|
||||
CopyBuffer = 0xc0,
|
||||
CopyBufferParams = 0x100,
|
||||
CopyBufferSwizzle = 0x1c2,
|
||||
CopyBufferDstTexture = 0x1c3,
|
||||
CopyBufferSrcTexture = 0x1ca,
|
||||
RtColorState = 0x200,
|
||||
CopyTextureControl = 0x223,
|
||||
CopyRegion = 0x22c,
|
||||
CopyTexture = 0x237,
|
||||
ViewportTransform = 0x280,
|
||||
ViewportExtents = 0x300,
|
||||
VertexBufferDrawState = 0x35d,
|
||||
ClearColors = 0x360,
|
||||
ClearDepthValue = 0x364,
|
||||
ClearStencilValue = 0x368,
|
||||
DepthBiasState = 0x370,
|
||||
TextureBarrier = 0x378,
|
||||
StencilBackMasks = 0x3d5,
|
||||
InvalidateTextures = 0x3dd,
|
||||
TextureBarrierTiled = 0x3df,
|
||||
RtDepthStencilState = 0x3f8,
|
||||
VertexAttribState = 0x458,
|
||||
RtDepthStencilSize = 0x48a,
|
||||
DepthTestEnable = 0x4b3,
|
||||
DepthWriteEnable = 0x4ba,
|
||||
DepthTestFunc = 0x4c3,
|
||||
BlendEnable = 0x4d8,
|
||||
StencilTestState = 0x4e0,
|
||||
FirstVertex = 0x50d,
|
||||
FirstInstance = 0x50e,
|
||||
ResetCounter = 0x54c,
|
||||
RtDepthStencilEnable = 0x54e,
|
||||
ConditionState = 0x554,
|
||||
SamplerPoolState = 0x557,
|
||||
DepthBiasFactor = 0x55b,
|
||||
TexturePoolState = 0x55d,
|
||||
StencilBackTestState = 0x565,
|
||||
DepthBiasUnits = 0x56f,
|
||||
RtMsaaMode = 0x574,
|
||||
ShaderBaseAddress = 0x582,
|
||||
DrawEnd = 0x585,
|
||||
DrawBegin = 0x586,
|
||||
PrimitiveRestartState = 0x591,
|
||||
IndexBufferState = 0x5f2,
|
||||
IndexBufferCount = 0x5f8,
|
||||
DepthBiasClamp = 0x61f,
|
||||
VertexBufferInstanced = 0x620,
|
||||
FaceState = 0x646,
|
||||
Clear = 0x674,
|
||||
RtColorMask = 0x680,
|
||||
ReportState = 0x6c0,
|
||||
Report = 0x6c3,
|
||||
VertexBufferState = 0x700,
|
||||
BlendState = 0x780,
|
||||
VertexBufferEndAddress = 0x7c0,
|
||||
ShaderState = 0x800,
|
||||
UniformBufferState = 0x8e0,
|
||||
UniformBufferUpdateData = 0x8e4,
|
||||
UniformBufferBindVertex = 0x904,
|
||||
UniformBufferBindTessControl = 0x90c,
|
||||
UniformBufferBindTessEvaluation = 0x914,
|
||||
UniformBufferBindGeometry = 0x91c,
|
||||
UniformBufferBindFragment = 0x924,
|
||||
TextureBufferIndex = 0x982
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
{
|
||||
struct PrimitiveRestartState
|
||||
{
|
||||
public bool Enable;
|
||||
public int Index;
|
||||
public Boolean32 Enable;
|
||||
public int Index;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,5 +9,13 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
public MemoryLayout MemoryLayout;
|
||||
public int Depth;
|
||||
public int LayerSize;
|
||||
public int BaseLayer;
|
||||
public int Unknown0x24;
|
||||
public int Padding0;
|
||||
public int Padding1;
|
||||
public int Padding2;
|
||||
public int Padding3;
|
||||
public int Padding4;
|
||||
public int Padding5;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
D32Float = 0xa,
|
||||
D16Unorm = 0x13,
|
||||
D24UnormS8Uint = 0x14,
|
||||
D24Unorm = 0x15,
|
||||
S8UintD24Unorm = 0x16,
|
||||
S8Uint = 0x17,
|
||||
D32FloatS8Uint = 0x19,
|
||||
R32G32B32A32Float = 0xc0,
|
||||
|
@ -74,6 +76,8 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
case RtFormat.D32Float: return new FormatInfo(Format.D32Float, 1, 1, 4);
|
||||
case RtFormat.D16Unorm: return new FormatInfo(Format.D16Unorm, 1, 1, 2);
|
||||
case RtFormat.D24UnormS8Uint: return new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4);
|
||||
case RtFormat.D24Unorm: return new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4);
|
||||
case RtFormat.S8UintD24Unorm: return new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4);
|
||||
case RtFormat.S8Uint: return new FormatInfo(Format.S8Uint, 1, 1, 1);
|
||||
case RtFormat.D32FloatS8Uint: return new FormatInfo(Format.D32FloatS8Uint, 1, 1, 8);
|
||||
case RtFormat.R32G32B32A32Float: return new FormatInfo(Format.R32G32B32A32Float, 1, 1, 16);
|
||||
|
|
|
@ -10,6 +10,14 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
public uint Unknown0x14;
|
||||
public uint Unknown0x18;
|
||||
public uint Unknown0x1c;
|
||||
public uint Unknown0x20;
|
||||
public uint Unknown0x24;
|
||||
public uint Unknown0x28;
|
||||
public uint Unknown0x2c;
|
||||
public uint Unknown0x30;
|
||||
public uint Unknown0x34;
|
||||
public uint Unknown0x38;
|
||||
public uint Unknown0x3c;
|
||||
|
||||
public bool UnpackEnable()
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
{
|
||||
struct StencilBackTestState
|
||||
{
|
||||
public Bool TwoSided;
|
||||
public Boolean32 TwoSided;
|
||||
public StencilOp BackSFail;
|
||||
public StencilOp BackDpFail;
|
||||
public StencilOp BackDpPass;
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
{
|
||||
struct StencilTestState
|
||||
{
|
||||
public Bool Enable;
|
||||
public Boolean32 Enable;
|
||||
public StencilOp FrontSFail;
|
||||
public StencilOp FrontDpFail;
|
||||
public StencilOp FrontDpPass;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue