diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2021-07-11 17:20:40 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-11 17:20:40 -0300 |
| commit | 40b21cc3c4d2622bbd4f88d43073341854d9a671 (patch) | |
| tree | 6e9dc6a42e7c0bae5b03db468481771d5a6937ef /Ryujinx.Graphics.Gpu/State | |
| parent | b5190f16810eb77388c861d1d1773e19644808db (diff) | |
Separate GPU engines (part 2/2) (#2440)
* 3D engine now uses DeviceState too, plus new state modification tracking
* Remove old methods code
* Remove GpuState and friends
* Optimize DeviceState, force inline some functions
* This change was not supposed to go in
* Proper channel initialization
* Optimize state read/write methods even more
* Fix debug build
* Do not dirty state if the write is redundant
* The YControl register should dirty either the viewport or front face state too, to update the host origin
* Avoid redundant vertex buffer updates
* Move state and get rid of the Ryujinx.Graphics.Gpu.State namespace
* Comments and nits
* Fix rebase
* PR feedback
* Move changed = false to improve codegen
* PR feedback
* Carry RyuJIT a bit more
Diffstat (limited to 'Ryujinx.Graphics.Gpu/State')
52 files changed, 0 insertions, 1931 deletions
diff --git a/Ryujinx.Graphics.Gpu/State/BlendState.cs b/Ryujinx.Graphics.Gpu/State/BlendState.cs deleted file mode 100644 index ba16b8bd..00000000 --- a/Ryujinx.Graphics.Gpu/State/BlendState.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Ryujinx.Graphics.GAL; - -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Color buffer blending parameters. - /// </summary> - struct BlendState - { -#pragma warning disable CS0649 - public Boolean32 SeparateAlpha; - public BlendOp ColorOp; - public BlendFactor ColorSrcFactor; - public BlendFactor ColorDstFactor; - public BlendOp AlphaOp; - public BlendFactor AlphaSrcFactor; - public BlendFactor AlphaDstFactor; - public uint Padding; -#pragma warning restore CS0649 - - public static BlendState Default = new BlendState - { - ColorOp = BlendOp.Add, - ColorSrcFactor = BlendFactor.One, - ColorDstFactor = BlendFactor.Zero, - AlphaOp = BlendOp.Add, - AlphaSrcFactor = BlendFactor.One, - AlphaDstFactor = BlendFactor.Zero - }; - } -} diff --git a/Ryujinx.Graphics.Gpu/State/BlendStateCommon.cs b/Ryujinx.Graphics.Gpu/State/BlendStateCommon.cs deleted file mode 100644 index f402a5a7..00000000 --- a/Ryujinx.Graphics.Gpu/State/BlendStateCommon.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Ryujinx.Graphics.GAL; - -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Color buffer blending parameters, shared by all color buffers. - /// </summary> - struct BlendStateCommon - { -#pragma warning disable CS0649 - public Boolean32 SeparateAlpha; - public BlendOp ColorOp; - public BlendFactor ColorSrcFactor; - public BlendFactor ColorDstFactor; - public BlendOp AlphaOp; - public BlendFactor AlphaSrcFactor; - public uint Unknown0x1354; - public BlendFactor AlphaDstFactor; -#pragma warning restore CS0649 - - public static BlendStateCommon Default = new BlendStateCommon - { - ColorOp = BlendOp.Add, - ColorSrcFactor = BlendFactor.One, - ColorDstFactor = BlendFactor.Zero, - AlphaOp = BlendOp.Add, - AlphaSrcFactor = BlendFactor.One, - AlphaDstFactor = BlendFactor.Zero - }; - } -} diff --git a/Ryujinx.Graphics.Gpu/State/Boolean32.cs b/Ryujinx.Graphics.Gpu/State/Boolean32.cs deleted file mode 100644 index 78e13b73..00000000 --- a/Ryujinx.Graphics.Gpu/State/Boolean32.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Boolean value, stored as a 32-bits integer in memory. - /// </summary> - struct Boolean32 - { -#pragma warning disable CS0649 - private uint _value; -#pragma warning restore CS0649 - - public static implicit operator bool(Boolean32 value) - { - return (value._value & 1) != 0; - } - } -} diff --git a/Ryujinx.Graphics.Gpu/State/ClearColors.cs b/Ryujinx.Graphics.Gpu/State/ClearColors.cs deleted file mode 100644 index ba29c899..00000000 --- a/Ryujinx.Graphics.Gpu/State/ClearColors.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Color buffer clear color. - /// </summary> - struct ClearColors - { -#pragma warning disable CS0649 - public float Red; - public float Green; - public float Blue; - public float Alpha; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/ColorFormat.cs b/Ryujinx.Graphics.Gpu/State/ColorFormat.cs deleted file mode 100644 index 11126396..00000000 --- a/Ryujinx.Graphics.Gpu/State/ColorFormat.cs +++ /dev/null @@ -1,134 +0,0 @@ -using Ryujinx.Graphics.GAL; -using Ryujinx.Graphics.Gpu.Image; - -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Color texture format. - /// </summary> - enum ColorFormat - { - R32G32B32A32Float = 0xc0, - R32G32B32A32Sint = 0xc1, - R32G32B32A32Uint = 0xc2, - R32G32B32X32Float = 0xc3, - R32G32B32X32Sint = 0xc4, - R32G32B32X32Uint = 0xc5, - R16G16B16X16Unorm = 0xc6, - R16G16B16X16Snorm = 0xc7, - R16G16B16X16Sint = 0xc8, - R16G16B16X16Uint = 0xc9, - R16G16B16A16Float = 0xca, - R32G32Float = 0xcb, - R32G32Sint = 0xcc, - R32G32Uint = 0xcd, - R16G16B16X16Float = 0xce, - B8G8R8A8Unorm = 0xcf, - B8G8R8A8Srgb = 0xd0, - R10G10B10A2Unorm = 0xd1, - R10G10B10A2Uint = 0xd2, - R8G8B8A8Unorm = 0xd5, - R8G8B8A8Srgb = 0xd6, - R8G8B8X8Snorm = 0xd7, - R8G8B8X8Sint = 0xd8, - R8G8B8X8Uint = 0xd9, - R16G16Unorm = 0xda, - R16G16Snorm = 0xdb, - R16G16Sint = 0xdc, - R16G16Uint = 0xdd, - R16G16Float = 0xde, - R11G11B10Float = 0xe0, - R32Sint = 0xe3, - R32Uint = 0xe4, - R32Float = 0xe5, - B8G8R8X8Unorm = 0xe6, - B8G8R8X8Srgb = 0xe7, - B5G6R5Unorm = 0xe8, - B5G5R5A1Unorm = 0xe9, - R8G8Unorm = 0xea, - R8G8Snorm = 0xeb, - R8G8Sint = 0xec, - R8G8Uint = 0xed, - R16Unorm = 0xee, - R16Snorm = 0xef, - R16Sint = 0xf0, - R16Uint = 0xf1, - R16Float = 0xf2, - R8Unorm = 0xf3, - R8Snorm = 0xf4, - R8Sint = 0xf5, - R8Uint = 0xf6, - B5G5R5X1Unorm = 0xf8, - R8G8B8X8Unorm = 0xf9, - R8G8B8X8Srgb = 0xfa - } - - static class ColorFormatConverter - { - /// <summary> - /// Converts the color texture format to a host compatible format. - /// </summary> - /// <param name="format">Color format</param> - /// <returns>Host compatible format enum value</returns> - public static FormatInfo Convert(this ColorFormat format) - { - return format switch - { - ColorFormat.R32G32B32A32Float => new FormatInfo(Format.R32G32B32A32Float, 1, 1, 16, 4), - ColorFormat.R32G32B32A32Sint => new FormatInfo(Format.R32G32B32A32Sint, 1, 1, 16, 4), - ColorFormat.R32G32B32A32Uint => new FormatInfo(Format.R32G32B32A32Uint, 1, 1, 16, 4), - ColorFormat.R32G32B32X32Float => new FormatInfo(Format.R32G32B32A32Float, 1, 1, 16, 4), - ColorFormat.R32G32B32X32Sint => new FormatInfo(Format.R32G32B32A32Sint, 1, 1, 16, 4), - ColorFormat.R32G32B32X32Uint => new FormatInfo(Format.R32G32B32A32Uint, 1, 1, 16, 4), - ColorFormat.R16G16B16X16Unorm => new FormatInfo(Format.R16G16B16A16Unorm, 1, 1, 8, 4), - ColorFormat.R16G16B16X16Snorm => new FormatInfo(Format.R16G16B16A16Snorm, 1, 1, 8, 4), - ColorFormat.R16G16B16X16Sint => new FormatInfo(Format.R16G16B16A16Sint, 1, 1, 8, 4), - ColorFormat.R16G16B16X16Uint => new FormatInfo(Format.R16G16B16A16Uint, 1, 1, 8, 4), - ColorFormat.R16G16B16A16Float => new FormatInfo(Format.R16G16B16A16Float, 1, 1, 8, 4), - ColorFormat.R32G32Float => new FormatInfo(Format.R32G32Float, 1, 1, 8, 2), - ColorFormat.R32G32Sint => new FormatInfo(Format.R32G32Sint, 1, 1, 8, 2), - ColorFormat.R32G32Uint => new FormatInfo(Format.R32G32Uint, 1, 1, 8, 2), - ColorFormat.R16G16B16X16Float => new FormatInfo(Format.R16G16B16A16Float, 1, 1, 8, 4), - ColorFormat.B8G8R8A8Unorm => new FormatInfo(Format.B8G8R8A8Unorm, 1, 1, 4, 4), - ColorFormat.B8G8R8A8Srgb => new FormatInfo(Format.B8G8R8A8Srgb, 1, 1, 4, 4), - ColorFormat.R10G10B10A2Unorm => new FormatInfo(Format.R10G10B10A2Unorm, 1, 1, 4, 4), - ColorFormat.R10G10B10A2Uint => new FormatInfo(Format.R10G10B10A2Uint, 1, 1, 4, 4), - ColorFormat.R8G8B8A8Unorm => new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4, 4), - ColorFormat.R8G8B8A8Srgb => new FormatInfo(Format.R8G8B8A8Srgb, 1, 1, 4, 4), - ColorFormat.R8G8B8X8Snorm => new FormatInfo(Format.R8G8B8A8Snorm, 1, 1, 4, 4), - ColorFormat.R8G8B8X8Sint => new FormatInfo(Format.R8G8B8A8Sint, 1, 1, 4, 4), - ColorFormat.R8G8B8X8Uint => new FormatInfo(Format.R8G8B8A8Uint, 1, 1, 4, 4), - ColorFormat.R16G16Unorm => new FormatInfo(Format.R16G16Unorm, 1, 1, 4, 2), - ColorFormat.R16G16Snorm => new FormatInfo(Format.R16G16Snorm, 1, 1, 4, 2), - ColorFormat.R16G16Sint => new FormatInfo(Format.R16G16Sint, 1, 1, 4, 2), - ColorFormat.R16G16Uint => new FormatInfo(Format.R16G16Uint, 1, 1, 4, 2), - ColorFormat.R16G16Float => new FormatInfo(Format.R16G16Float, 1, 1, 4, 2), - ColorFormat.R11G11B10Float => new FormatInfo(Format.R11G11B10Float, 1, 1, 4, 3), - ColorFormat.R32Sint => new FormatInfo(Format.R32Sint, 1, 1, 4, 1), - ColorFormat.R32Uint => new FormatInfo(Format.R32Uint, 1, 1, 4, 1), - ColorFormat.R32Float => new FormatInfo(Format.R32Float, 1, 1, 4, 1), - ColorFormat.B8G8R8X8Unorm => new FormatInfo(Format.B8G8R8A8Unorm, 1, 1, 4, 4), - ColorFormat.B8G8R8X8Srgb => new FormatInfo(Format.B8G8R8A8Srgb, 1, 1, 4, 4), - ColorFormat.B5G6R5Unorm => new FormatInfo(Format.B5G6R5Unorm, 1, 1, 2, 3), - ColorFormat.B5G5R5A1Unorm => new FormatInfo(Format.B5G5R5A1Unorm, 1, 1, 2, 4), - ColorFormat.R8G8Unorm => new FormatInfo(Format.R8G8Unorm, 1, 1, 2, 2), - ColorFormat.R8G8Snorm => new FormatInfo(Format.R8G8Snorm, 1, 1, 2, 2), - ColorFormat.R8G8Sint => new FormatInfo(Format.R8G8Sint, 1, 1, 2, 2), - ColorFormat.R8G8Uint => new FormatInfo(Format.R8G8Uint, 1, 1, 2, 2), - ColorFormat.R16Unorm => new FormatInfo(Format.R16Unorm, 1, 1, 2, 1), - ColorFormat.R16Snorm => new FormatInfo(Format.R16Snorm, 1, 1, 2, 1), - ColorFormat.R16Sint => new FormatInfo(Format.R16Sint, 1, 1, 2, 1), - ColorFormat.R16Uint => new FormatInfo(Format.R16Uint, 1, 1, 2, 1), - ColorFormat.R16Float => new FormatInfo(Format.R16Float, 1, 1, 2, 1), - ColorFormat.R8Unorm => new FormatInfo(Format.R8Unorm, 1, 1, 1, 1), - ColorFormat.R8Snorm => new FormatInfo(Format.R8Snorm, 1, 1, 1, 1), - ColorFormat.R8Sint => new FormatInfo(Format.R8Sint, 1, 1, 1, 1), - ColorFormat.R8Uint => new FormatInfo(Format.R8Uint, 1, 1, 1, 1), - ColorFormat.B5G5R5X1Unorm => new FormatInfo(Format.B5G5R5X1Unorm, 1, 1, 2, 4), - ColorFormat.R8G8B8X8Unorm => new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4, 4), - ColorFormat.R8G8B8X8Srgb => new FormatInfo(Format.R8G8B8A8Srgb, 1, 1, 4, 4), - _ => FormatInfo.Default - }; - } - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/Condition.cs b/Ryujinx.Graphics.Gpu/State/Condition.cs deleted file mode 100644 index 5afdbe3e..00000000 --- a/Ryujinx.Graphics.Gpu/State/Condition.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Condition for conditional rendering. - /// </summary> - enum Condition - { - Never, - Always, - ResultNonZero, - Equal, - NotEqual - } -} diff --git a/Ryujinx.Graphics.Gpu/State/ConditionState.cs b/Ryujinx.Graphics.Gpu/State/ConditionState.cs deleted file mode 100644 index 3388e8f0..00000000 --- a/Ryujinx.Graphics.Gpu/State/ConditionState.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Condition parameters for conditional rendering. - /// </summary> - struct ConditionState - { -#pragma warning disable CS0649 - public GpuVa Address; - public Condition Condition; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/CopyBufferTexture.cs b/Ryujinx.Graphics.Gpu/State/CopyBufferTexture.cs deleted file mode 100644 index dfbab37a..00000000 --- a/Ryujinx.Graphics.Gpu/State/CopyBufferTexture.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Buffer to texture copy parameters. - /// </summary> - struct CopyBufferTexture - { -#pragma warning disable CS0649 - public MemoryLayout MemoryLayout; - public int Width; - public int Height; - public int Depth; - public int RegionZ; - public ushort RegionX; - public ushort RegionY; -#pragma warning restore CS0649 - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/CopyRegion.cs b/Ryujinx.Graphics.Gpu/State/CopyRegion.cs deleted file mode 100644 index 29889835..00000000 --- a/Ryujinx.Graphics.Gpu/State/CopyRegion.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Texture copy region. - /// </summary> - struct CopyRegion - { -#pragma warning disable CS0649 - public int DstX; - public int DstY; - public int DstWidth; - public int DstHeight; - public long SrcWidthRF; - public long SrcHeightRF; - public long SrcXF; - public long SrcYF; -#pragma warning restore CS0649 - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/CopyTexture.cs b/Ryujinx.Graphics.Gpu/State/CopyTexture.cs deleted file mode 100644 index 28ea0bd8..00000000 --- a/Ryujinx.Graphics.Gpu/State/CopyTexture.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Texture to texture (with optional resizing) copy parameters. - /// </summary> - struct CopyTexture - { -#pragma warning disable CS0649 - public ColorFormat Format; - public Boolean32 LinearLayout; - public MemoryLayout MemoryLayout; - public int Depth; - public int Layer; - public int Stride; - public int Width; - public int Height; - public GpuVa Address; -#pragma warning restore CS0649 - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/DepthBiasState.cs b/Ryujinx.Graphics.Gpu/State/DepthBiasState.cs deleted file mode 100644 index 0a125804..00000000 --- a/Ryujinx.Graphics.Gpu/State/DepthBiasState.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Depth bias (also called polygon offset) parameters. - /// </summary> - struct DepthBiasState - { -#pragma warning disable CS0649 - public Boolean32 PointEnable; - public Boolean32 LineEnable; - public Boolean32 FillEnable; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/FaceState.cs b/Ryujinx.Graphics.Gpu/State/FaceState.cs deleted file mode 100644 index e817b3ae..00000000 --- a/Ryujinx.Graphics.Gpu/State/FaceState.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Ryujinx.Graphics.GAL; - -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Face culling and orientation parameters. - /// </summary> - struct FaceState - { -#pragma warning disable CS0649 - public Boolean32 CullEnable; - public FrontFace FrontFace; - public Face CullFace; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/GpuState.cs b/Ryujinx.Graphics.Gpu/State/GpuState.cs deleted file mode 100644 index 0b209da7..00000000 --- a/Ryujinx.Graphics.Gpu/State/GpuState.cs +++ /dev/null @@ -1,477 +0,0 @@ -using Ryujinx.Graphics.Device; -using Ryujinx.Graphics.Gpu.Image; -using System; -using System.Runtime.InteropServices; - -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// GPU state. - /// </summary> - class GpuState - { - private const int RegistersCount = 0xe00; - - public delegate void MethodCallback(GpuState state, int argument); - - private readonly int[] _memory; - private readonly int[] _shadow; - - /// <summary> - /// GPU register information. - /// </summary> - private struct Register - { - public MethodCallback Callback; - - public MethodOffset BaseOffset; - - public int Stride; - public int Count; - - public bool Modified; - } - - private readonly Register[] _registers; - - private readonly IDeviceState _deviceState; - - /// <summary> - /// Gets or sets the shadow ram control used for this sub-channel. - /// </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> - /// <param name="channel">Channel that the sub-channel state belongs to</param> - /// <param name="deviceState">Optional device state that will replace the internal backing storage</param> - public GpuState(GpuChannel channel, IDeviceState deviceState = null) - { - Channel = channel; - _deviceState = deviceState; - - _memory = new int[RegistersCount]; - _shadow = new int[RegistersCount]; - - _registers = new Register[RegistersCount]; - - 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(_memory); - InitializeDefaultState(_shadow); - } - - /// <summary> - /// Calls a GPU method, using this state. - /// </summary> - /// <param name="meth">The GPU method to be called</param> - public void CallMethod(MethodParams meth) - { - int value = meth.Argument; - - // Methods < 0x80 shouldn't be affected by shadow RAM at all. - if (meth.Method >= 0x80) - { - ShadowRamControl shadowCtrl = ShadowRamControl; - - // TODO: Figure out what TrackWithFilter does, compared to Track. - if (shadowCtrl == ShadowRamControl.Track || - shadowCtrl == ShadowRamControl.TrackWithFilter) - { - _shadow[meth.Method] = value; - } - else if (shadowCtrl == ShadowRamControl.Replay) - { - value = _shadow[meth.Method]; - } - } - - if (_deviceState != null) - { - _deviceState.Write(meth.Method * 4, meth.Argument); - } - else - { - Register register = _registers[meth.Method]; - - if (_memory[meth.Method] != value) - { - _registers[(int)register.BaseOffset].Modified = true; - } - - _memory[meth.Method] = value; - - register.Callback?.Invoke(this, value); - } - } - - /// <summary> - /// Reads data from a GPU register at the given offset. - /// </summary> - /// <param name="offset">Offset to be read</param> - /// <returns>Data at the register</returns> - public int Read(int offset) - { - if (_deviceState != null) - { - return _deviceState.Read(offset * 4); - } - - return _memory[offset]; - } - - /// <summary> - /// Writes data to the GPU register at the given offset. - /// </summary> - /// <param name="offset">Offset to be written</param> - /// <param name="value">Value to be written</param> - public void Write(int offset, int value) - { - _memory[offset] = value; - } - - /// <summary> - /// Writes an offset value at the uniform buffer offset register. - /// </summary> - /// <param name="offset">The offset to be written</param> - public void SetUniformBufferOffset(int offset) - { - _memory[(int)MethodOffset.UniformBufferState + 3] = offset; - } - - /// <summary> - /// Initializes registers with the default state. - /// </summary> - private void InitializeDefaultState(int[] memory) - { - // Enable Rasterizer - memory[(int)MethodOffset.RasterizeEnable] = 1; - - // Depth ranges. - for (int index = 0; index < Constants.TotalViewports; index++) - { - memory[(int)MethodOffset.ViewportExtents + index * 4 + 2] = 0; - memory[(int)MethodOffset.ViewportExtents + index * 4 + 3] = 0x3F800000; - - // Set swizzle to +XYZW - memory[(int)MethodOffset.ViewportTransform + index * 8 + 6] = 0x6420; - } - - // Viewport transform enable. - memory[(int)MethodOffset.ViewportTransformEnable] = 1; - - // Default front stencil mask. - memory[0x4e7] = 0xff; - - // Conditional rendering condition. - memory[0x556] = (int)Condition.Always; - - // Default color mask. - for (int index = 0; index < Constants.TotalRenderTargets; index++) - { - memory[(int)MethodOffset.RtColorMask + index] = 0x1111; - } - - // Default blend states - Set(MethodOffset.BlendStateCommon, BlendStateCommon.Default); - - for (int index = 0; index < Constants.TotalRenderTargets; index++) - { - Set(MethodOffset.BlendState, index, BlendState.Default); - } - - // Default Point Parameters - memory[(int)MethodOffset.PointSpriteEnable] = 1; - memory[(int)MethodOffset.PointSize] = 0x3F800000; // 1.0f - memory[(int)MethodOffset.PointCoordReplace] = 0x8; // Enable - } - - /// <summary> - /// Registers a callback that is called every time a GPU method, or methods are called. - /// </summary> - /// <param name="offset">Offset of the method</param> - /// <param name="count">Word count of the methods region</param> - /// <param name="callback">Calllback to be called</param> - public void RegisterCallback(MethodOffset offset, int count, MethodCallback callback) - { - for (int index = 0; index < count; index++) - { - _registers[(int)offset + index].Callback = callback; - } - } - - /// <summary> - /// Registers a callback that is called every time a GPU method is called. - /// </summary> - /// <param name="offset">Offset of the method</param> - /// <param name="callback">Calllback to be called</param> - public void RegisterCallback(MethodOffset offset, MethodCallback callback) - { - _registers[(int)offset].Callback = callback; - } - - /// <summary> - /// Clear all registered callbacks. - /// </summary> - public void ClearCallbacks() - { - for (int index = 0; index < _registers.Length; index++) - { - _registers[index].Callback = null; - } - } - - /// <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> - /// <returns>True if modified, false otherwise</returns> - public bool QueryModified(MethodOffset offset) - { - bool modified = _registers[(int)offset].Modified; - - _registers[(int)offset].Modified = false; - - return modified; - } - - /// <summary> - /// Checks if two registers have been modified since the last call to this method. - /// </summary> - /// <param name="m1">First register offset</param> - /// <param name="m2">Second register offset</param> - /// <returns>True if any register was modified, false otherwise</returns> - public bool QueryModified(MethodOffset m1, MethodOffset m2) - { - bool modified = _registers[(int)m1].Modified || - _registers[(int)m2].Modified; - - _registers[(int)m1].Modified = false; - _registers[(int)m2].Modified = false; - - return modified; - } - - /// <summary> - /// Checks if three registers have been modified since the last call to this method. - /// </summary> - /// <param name="m1">First register offset</param> - /// <param name="m2">Second register offset</param> - /// <param name="m3">Third register offset</param> - /// <returns>True if any register was modified, false otherwise</returns> - public bool QueryModified(MethodOffset m1, MethodOffset m2, MethodOffset m3) - { - bool modified = _registers[(int)m1].Modified || - _registers[(int)m2].Modified || - _registers[(int)m3].Modified; - - _registers[(int)m1].Modified = false; - _registers[(int)m2].Modified = false; - _registers[(int)m3].Modified = false; - - return modified; - } - - /// <summary> - /// Checks if four registers have been modified since the last call to this method. - /// </summary> - /// <param name="m1">First register offset</param> - /// <param name="m2">Second register offset</param> - /// <param name="m3">Third register offset</param> - /// <param name="m4">Fourth register offset</param> - /// <returns>True if any register was modified, false otherwise</returns> - public bool QueryModified(MethodOffset m1, MethodOffset m2, MethodOffset m3, MethodOffset m4) - { - bool modified = _registers[(int)m1].Modified || - _registers[(int)m2].Modified || - _registers[(int)m3].Modified || - _registers[(int)m4].Modified; - - _registers[(int)m1].Modified = false; - _registers[(int)m2].Modified = false; - _registers[(int)m3].Modified = false; - _registers[(int)m4].Modified = false; - - return modified; - } - - /// <summary> - /// Checks if five registers have been modified since the last call to this method. - /// </summary> - /// <param name="m1">First register offset</param> - /// <param name="m2">Second register offset</param> - /// <param name="m3">Third register offset</param> - /// <param name="m4">Fourth register offset</param> - /// <param name="m5">Fifth register offset</param> - /// <returns>True if any register was modified, false otherwise</returns> - public bool QueryModified( - MethodOffset m1, - MethodOffset m2, - MethodOffset m3, - MethodOffset m4, - MethodOffset m5) - { - bool modified = _registers[(int)m1].Modified || - _registers[(int)m2].Modified || - _registers[(int)m3].Modified || - _registers[(int)m4].Modified || - _registers[(int)m5].Modified; - - _registers[(int)m1].Modified = false; - _registers[(int)m2].Modified = false; - _registers[(int)m3].Modified = false; - _registers[(int)m4].Modified = false; - _registers[(int)m5].Modified = false; - - return modified; - } - - /// <summary> - /// Checks if six registers have been modified since the last call to this method. - /// </summary> - /// <param name="m1">First register offset</param> - /// <param name="m2">Second register offset</param> - /// <param name="m3">Third register offset</param> - /// <param name="m4">Fourth register offset</param> - /// <param name="m5">Fifth register offset</param> - /// <param name="m6">Sixth register offset</param> - /// <returns>True if any register was modified, false otherwise</returns> - public bool QueryModified( - MethodOffset m1, - MethodOffset m2, - MethodOffset m3, - MethodOffset m4, - MethodOffset m5, - MethodOffset m6) - { - bool modified = _registers[(int)m1].Modified || - _registers[(int)m2].Modified || - _registers[(int)m3].Modified || - _registers[(int)m4].Modified || - _registers[(int)m5].Modified || - _registers[(int)m6].Modified; - - _registers[(int)m1].Modified = false; - _registers[(int)m2].Modified = false; - _registers[(int)m3].Modified = false; - _registers[(int)m4].Modified = false; - _registers[(int)m5].Modified = false; - _registers[(int)m6].Modified = false; - - return modified; - } - - /// <summary> - /// Gets indexed data from a given register offset. - /// </summary> - /// <typeparam name="T">Type of the data</typeparam> - /// <param name="offset">Register offset</param> - /// <param name="index">Index for indexed data</param> - /// <returns>The data at the specified location</returns> - public T Get<T>(MethodOffset offset, int index) where T : unmanaged - { - Register register = _registers[(int)offset]; - - if ((uint)index >= register.Count) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - - return Get<T>(offset + index * register.Stride); - } - - /// <summary> - /// Gets data from a given register offset. - /// </summary> - /// <typeparam name="T">Type of the data</typeparam> - /// <param name="offset">Register offset</param> - /// <returns>The data at the specified location</returns> - public T Get<T>(MethodOffset offset) where T : unmanaged - { - return MemoryMarshal.Cast<int, T>(_memory.AsSpan().Slice((int)offset))[0]; - } - - /// <summary> - /// Gets a span of the data at a given register offset. - /// </summary> - /// <param name="offset">Register offset</param> - /// <param name="length">Length of the data in bytes</param> - /// <returns>The data at the specified location</returns> - public Span<byte> GetSpan(MethodOffset offset, int length) - { - return MemoryMarshal.Cast<int, byte>(_memory.AsSpan().Slice((int)offset)).Slice(0, length); - } - - /// <summary> - /// Sets indexed data to a given register offset. - /// </summary> - /// <typeparam name="T">Type of the data</typeparam> - /// <param name="offset">Register offset</param> - /// <param name="index">Index for indexed data</param> - /// <param name="data">The data to set</param> - public void Set<T>(MethodOffset offset, int index, T data) where T : unmanaged - { - Register register = _registers[(int)offset]; - - if ((uint)index >= register.Count) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - - Set(offset + index * register.Stride, data); - } - - /// <summary> - /// Sets data to a given register offset. - /// </summary> - /// <typeparam name="T">Type of the data</typeparam> - /// <param name="offset">Register offset</param> - /// <param name="data">The data to set</param> - public void Set<T>(MethodOffset offset, T data) where T : unmanaged - { - ReadOnlySpan<int> intSpan = MemoryMarshal.Cast<T, int>(MemoryMarshal.CreateReadOnlySpan(ref data, 1)); - intSpan.CopyTo(_memory.AsSpan().Slice((int)offset, intSpan.Length)); - } - } -} diff --git a/Ryujinx.Graphics.Gpu/State/GpuStateTable.cs b/Ryujinx.Graphics.Gpu/State/GpuStateTable.cs deleted file mode 100644 index 899e0a59..00000000 --- a/Ryujinx.Graphics.Gpu/State/GpuStateTable.cs +++ /dev/null @@ -1,87 +0,0 @@ -using Ryujinx.Graphics.GAL; -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; - -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// GPU State item sizes table. - /// </summary> - static class GpuStateTable - { - /// <summary> - /// GPU state table item, with size for structures, and count for indexed state data. - /// </summary> - public struct TableItem - { - /// <summary> - /// Offset of the data. - /// </summary> - public MethodOffset Offset { get; } - - /// <summary> - /// Size in words. - /// </summary> - public int Size { get; } - - /// <summary> - /// Count for indexed data, or 1 if not indexed. - /// </summary> - public int Count { get; } - - /// <summary> - /// Constructs the table item structure. - /// </summary> - /// <param name="offset">Data offset</param> - /// <param name="type">Data type</param> - /// <param name="count">Data count, for indexed data</param> - 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; - } - } - - /// <summary> - /// Table of GPU state structure sizes and counts. - /// </summary> - public static TableItem[] Table = new TableItem[] - { - new TableItem(MethodOffset.TfBufferState, typeof(TfBufferState), Constants.TotalTransformFeedbackBuffers), - new TableItem(MethodOffset.TfState, typeof(TfState), Constants.TotalTransformFeedbackBuffers), - new TableItem(MethodOffset.RtColorState, typeof(RtColorState), Constants.TotalRenderTargets), - new TableItem(MethodOffset.ViewportTransform, typeof(ViewportTransform), Constants.TotalViewports), - new TableItem(MethodOffset.ViewportExtents, typeof(ViewportExtents), Constants.TotalViewports), - new TableItem(MethodOffset.VertexBufferDrawState, typeof(VertexBufferDrawState), 1), - new TableItem(MethodOffset.DepthBiasState, typeof(DepthBiasState), 1), - new TableItem(MethodOffset.ScissorState, typeof(ScissorState), Constants.TotalViewports), - new TableItem(MethodOffset.StencilBackMasks, typeof(StencilBackMasks), 1), - new TableItem(MethodOffset.RtDepthStencilState, typeof(RtDepthStencilState), 1), - new TableItem(MethodOffset.VertexAttribState, typeof(VertexAttribState), Constants.TotalVertexAttribs), - new TableItem(MethodOffset.RtDepthStencilSize, typeof(Size3D), 1), - new TableItem(MethodOffset.BlendEnable, typeof(Boolean32), Constants.TotalRenderTargets), - 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), Constants.TotalVertexBuffers), - new TableItem(MethodOffset.FaceState, typeof(FaceState), 1), - new TableItem(MethodOffset.RtColorMask, typeof(RtColorMask), Constants.TotalRenderTargets), - new TableItem(MethodOffset.VertexBufferState, typeof(VertexBufferState), Constants.TotalVertexBuffers), - new TableItem(MethodOffset.BlendConstant, typeof(ColorF), 1), - new TableItem(MethodOffset.BlendStateCommon, typeof(BlendStateCommon), 1), - new TableItem(MethodOffset.BlendState, typeof(BlendState), Constants.TotalRenderTargets), - new TableItem(MethodOffset.VertexBufferEndAddress, typeof(GpuVa), Constants.TotalVertexBuffers), - new TableItem(MethodOffset.ShaderState, typeof(ShaderState), Constants.ShaderStages + 1), - }; - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/GpuVa.cs b/Ryujinx.Graphics.Gpu/State/GpuVa.cs deleted file mode 100644 index d6b7def3..00000000 --- a/Ryujinx.Graphics.Gpu/State/GpuVa.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Split GPU virtual address. - /// </summary> - struct GpuVa - { -#pragma warning disable CS0649 - public uint High; - public uint Low; -#pragma warning restore CS0649 - - /// <summary> - /// Packs the split address into a 64-bits address value. - /// </summary> - /// <returns>The 64-bits address value</returns> - public ulong Pack() - { - return Low | ((ulong)High << 32); - } - } -} diff --git a/Ryujinx.Graphics.Gpu/State/IndexBufferState.cs b/Ryujinx.Graphics.Gpu/State/IndexBufferState.cs deleted file mode 100644 index 8ae38bb8..00000000 --- a/Ryujinx.Graphics.Gpu/State/IndexBufferState.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Ryujinx.Graphics.GAL; - -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// GPU index buffer state. - /// This is used on indexed draws. - /// </summary> - struct IndexBufferState - { -#pragma warning disable CS0649 - public GpuVa Address; - public GpuVa EndAddress; - public IndexType Type; - public int First; - public int Count; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/Inline2MemoryParams.cs b/Ryujinx.Graphics.Gpu/State/Inline2MemoryParams.cs deleted file mode 100644 index f4009592..00000000 --- a/Ryujinx.Graphics.Gpu/State/Inline2MemoryParams.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Inline-to-memory copy parameters. - /// </summary> - struct Inline2MemoryParams - { -#pragma warning disable CS0649 - public int LineLengthIn; - public int LineCount; - public GpuVa DstAddress; - public int DstStride; - public MemoryLayout DstMemoryLayout; - public int DstWidth; - public int DstHeight; - public int DstDepth; - public int DstZ; - public int DstX; - public int DstY; -#pragma warning restore CS0649 - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/LogicalOpState.cs b/Ryujinx.Graphics.Gpu/State/LogicalOpState.cs deleted file mode 100644 index d052a45c..00000000 --- a/Ryujinx.Graphics.Gpu/State/LogicalOpState.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Ryujinx.Graphics.GAL; - -namespace Ryujinx.Graphics.Gpu.State -{ - struct LogicalOpState - { -#pragma warning disable CS0649 - public Boolean32 Enable; - public LogicalOp LogicalOp; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/MemoryLayout.cs b/Ryujinx.Graphics.Gpu/State/MemoryLayout.cs deleted file mode 100644 index c98831f9..00000000 --- a/Ryujinx.Graphics.Gpu/State/MemoryLayout.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Memory layout parameters, for block linear textures. - /// </summary> - struct MemoryLayout - { -#pragma warning disable CS0649 - public uint Packed; -#pragma warning restore CS0649 - - public int UnpackGobBlocksInX() - { - return 1 << (int)(Packed & 0xf); - } - - public int UnpackGobBlocksInY() - { - return 1 << (int)((Packed >> 4) & 0xf); - } - - public int UnpackGobBlocksInZ() - { - return 1 << (int)((Packed >> 8) & 0xf); - } - - public bool UnpackIsLinear() - { - return (Packed & 0x1000) != 0; - } - - public bool UnpackIsTarget3D() - { - return (Packed & 0x10000) != 0; - } - } -} diff --git a/Ryujinx.Graphics.Gpu/State/MethodOffset.cs b/Ryujinx.Graphics.Gpu/State/MethodOffset.cs deleted file mode 100644 index 1ddef95c..00000000 --- a/Ryujinx.Graphics.Gpu/State/MethodOffset.cs +++ /dev/null @@ -1,134 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// GPU method offset. - /// </summary> - /// <remarks> - /// This is indexed in 32 bits word. - /// </remarks> - enum MethodOffset - { - BindChannel = 0x0, - I2mParams = 0x60, - LaunchDma = 0x6c, - LoadInlineData = 0x6d, - CopyDstTexture = 0x80, - EarlyZForce = 0x84, - CopySrcTexture = 0x8c, - DispatchParamsAddress = 0xad, - Dispatch = 0xaf, - SyncpointAction = 0xb2, - CopyBuffer = 0xc0, - RasterizeEnable = 0xdf, - TfBufferState = 0xe0, - CopyBufferParams = 0x100, - TfState = 0x1c0, - CopyBufferConstA = 0x1c0, - CopyBufferConstB = 0x1c1, - CopyBufferSwizzle = 0x1c2, - CopyBufferDstTexture = 0x1c3, - CopyBufferSrcTexture = 0x1ca, - TfEnable = 0x1d1, - RtColorState = 0x200, - CopyTextureControl = 0x223, - CopyRegion = 0x22c, - CopyTexture = 0x237, - ViewportTransform = 0x280, - ViewportExtents = 0x300, - VertexBufferDrawState = 0x35d, - DepthMode = 0x35f, - ClearColors = 0x360, - ClearDepthValue = 0x364, - ClearStencilValue = 0x368, - DepthBiasState = 0x370, - TextureBarrier = 0x378, - ScissorState = 0x380, - StencilBackMasks = 0x3d5, - InvalidateTextures = 0x3dd, - TextureBarrierTiled = 0x3df, - RtColorMaskShared = 0x3e4, - RtDepthStencilState = 0x3f8, - ScreenScissorState = 0x3fd, - VertexAttribState = 0x458, - RtControl = 0x487, - RtDepthStencilSize = 0x48a, - SamplerIndex = 0x48d, - DepthTestEnable = 0x4b3, - BlendIndependent = 0x4b9, - DepthWriteEnable = 0x4ba, - AlphaTestEnable = 0x4bb, - VbElementU8 = 0x4c1, - DepthTestFunc = 0x4c3, - AlphaTestRef = 0x4c4, - AlphaTestFunc = 0x4c5, - BlendConstant = 0x4c7, - BlendStateCommon = 0x4cf, - BlendEnableCommon = 0x4d7, - BlendEnable = 0x4d8, - StencilTestState = 0x4e0, - YControl = 0x4eb, - LineWidthSmooth = 0x4ec, - LineWidthAliased = 0x4ed, - FirstVertex = 0x50d, - FirstInstance = 0x50e, - ClipDistanceEnable = 0x544, - PointSize = 0x546, - PointSpriteEnable = 0x548, - ResetCounter = 0x54c, - RtDepthStencilEnable = 0x54e, - ConditionState = 0x554, - SamplerPoolState = 0x557, - DepthBiasFactor = 0x55b, - LineSmoothEnable = 0x55c, - TexturePoolState = 0x55d, - StencilBackTestState = 0x565, - DepthBiasUnits = 0x56f, - RtMsaaMode = 0x574, - VbElementU32 = 0x57a, - VbElementU16 = 0x57c, - PointCoordReplace = 0x581, - ShaderBaseAddress = 0x582, - DrawEnd = 0x585, - DrawBegin = 0x586, - PrimitiveRestartState = 0x591, - IndexBufferState = 0x5f2, - IndexBufferCount = 0x5f8, - DrawIndexedSmall = 0x5f9, - DrawIndexedSmall2 = 0x5fa, - DrawIndexedSmallIncInstance = 0x5fc, - DrawIndexedSmallIncInstance2 = 0x5fd, - DepthBiasClamp = 0x61f, - VertexBufferInstanced = 0x620, - VertexProgramPointSize = 0x644, - FaceState = 0x646, - ViewportTransformEnable = 0x64b, - ViewVolumeClipControl = 0x64f, - PrimitiveTypeOverride = 0x65c, - LogicOpState = 0x671, - Clear = 0x674, - RtColorMask = 0x680, - ReportState = 0x6c0, - Report = 0x6c3, - VertexBufferState = 0x700, - BlendState = 0x780, - VertexBufferEndAddress = 0x7c0, - ShaderState = 0x800, - FirmwareCall0 = 0x8c0, - FirmwareCall1 = 0x8c1, - FirmwareCall2 = 0x8c2, - FirmwareCall3 = 0x8c3, - FirmwareCall4 = 0x8c4, - FirmwareCall5 = 0x8c5, - FirmwareCall6 = 0x8c6, - FirmwareCall7 = 0x8c7, - UniformBufferState = 0x8e0, - UniformBufferUpdateData = 0x8e4, - UniformBufferBindVertex = 0x904, - UniformBufferBindTessControl = 0x90c, - UniformBufferBindTessEvaluation = 0x914, - UniformBufferBindGeometry = 0x91c, - UniformBufferBindFragment = 0x924, - TextureBufferIndex = 0x982, - TfVaryingLocations = 0xa00 - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/PoolState.cs b/Ryujinx.Graphics.Gpu/State/PoolState.cs deleted file mode 100644 index ba4dfb78..00000000 --- a/Ryujinx.Graphics.Gpu/State/PoolState.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Texture or sampler pool state. - /// </summary> - struct PoolState - { -#pragma warning disable CS0649 - public GpuVa Address; - public int MaximumId; -#pragma warning restore CS0649 - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/PrimitiveRestartState.cs b/Ryujinx.Graphics.Gpu/State/PrimitiveRestartState.cs deleted file mode 100644 index d046b522..00000000 --- a/Ryujinx.Graphics.Gpu/State/PrimitiveRestartState.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Primitive restart state. - /// </summary> - struct PrimitiveRestartState - { -#pragma warning disable CS0649 - public Boolean32 Enable; - public int Index; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/PrimitiveType.cs b/Ryujinx.Graphics.Gpu/State/PrimitiveType.cs deleted file mode 100644 index b49088aa..00000000 --- a/Ryujinx.Graphics.Gpu/State/PrimitiveType.cs +++ /dev/null @@ -1,100 +0,0 @@ -using Ryujinx.Graphics.GAL; - -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Draw primitive type. - /// </summary> - enum PrimitiveType - { - Points, - Lines, - LineLoop, - LineStrip, - Triangles, - TriangleStrip, - TriangleFan, - Quads, - QuadStrip, - Polygon, - LinesAdjacency, - LineStripAdjacency, - TrianglesAdjacency, - TriangleStripAdjacency, - Patches - } - - /// <summary> - /// Alternative primitive type that might override <see cref="PrimitiveType"/>. - /// </summary> - enum PrimitiveTypeOverride - { - Invalid = 0, - Points = 1, - Lines = 2, - LineStrip = 3, - Triangles = 4, - TriangleStrip = 5, - TriangleFan = 0x1015, - LinesAdjacency = 10, - LineStripAdjacency = 11, - TrianglesAdjacency = 12, - TriangleStripAdjacency = 13, - Patches = 14 - } - - static class PrimitiveTypeConverter - { - /// <summary> - /// Converts the primitive type into something that can be used with the host API. - /// </summary> - /// <param name="type">The primitive type to convert</param> - /// <returns>A host compatible enum value</returns> - public static PrimitiveTopology Convert(this PrimitiveType type) - { - return type switch - { - PrimitiveType.Points => PrimitiveTopology.Points, - PrimitiveType.Lines => PrimitiveTopology.Lines, - PrimitiveType.LineLoop => PrimitiveTopology.LineLoop, - PrimitiveType.LineStrip => PrimitiveTopology.LineStrip, - PrimitiveType.Triangles => PrimitiveTopology.Triangles, - PrimitiveType.TriangleStrip => PrimitiveTopology.TriangleStrip, - PrimitiveType.TriangleFan => PrimitiveTopology.TriangleFan, - PrimitiveType.Quads => PrimitiveTopology.Quads, - PrimitiveType.QuadStrip => PrimitiveTopology.QuadStrip, - PrimitiveType.Polygon => PrimitiveTopology.Polygon, - PrimitiveType.LinesAdjacency => PrimitiveTopology.LinesAdjacency, - PrimitiveType.LineStripAdjacency => PrimitiveTopology.LineStripAdjacency, - PrimitiveType.TrianglesAdjacency => PrimitiveTopology.TrianglesAdjacency, - PrimitiveType.TriangleStripAdjacency => PrimitiveTopology.TriangleStripAdjacency, - PrimitiveType.Patches => PrimitiveTopology.Patches, - _ => PrimitiveTopology.Triangles - }; - } - - /// <summary> - /// Converts the primitive type into something that can be used with the host API. - /// </summary> - /// <param name="type">The primitive type to convert</param> - /// <returns>A host compatible enum value</returns> - public static PrimitiveTopology Convert(this PrimitiveTypeOverride type) - { - return type switch - { - PrimitiveTypeOverride.Points => PrimitiveTopology.Points, - PrimitiveTypeOverride.Lines => PrimitiveTopology.Lines, - PrimitiveTypeOverride.LineStrip => PrimitiveTopology.LineStrip, - PrimitiveTypeOverride.Triangles => PrimitiveTopology.Triangles, - PrimitiveTypeOverride.TriangleStrip => PrimitiveTopology.TriangleStrip, - PrimitiveTypeOverride.TriangleFan => PrimitiveTopology.TriangleFan, - PrimitiveTypeOverride.LinesAdjacency => PrimitiveTopology.LinesAdjacency, - PrimitiveTypeOverride.LineStripAdjacency => PrimitiveTopology.LineStripAdjacency, - PrimitiveTypeOverride.TrianglesAdjacency => PrimitiveTopology.TrianglesAdjacency, - PrimitiveTypeOverride.TriangleStripAdjacency => PrimitiveTopology.TriangleStripAdjacency, - PrimitiveTypeOverride.Patches => PrimitiveTopology.Patches, - _ => PrimitiveTopology.Triangles - }; - } - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/ReportCounterType.cs b/Ryujinx.Graphics.Gpu/State/ReportCounterType.cs deleted file mode 100644 index 6bde2844..00000000 --- a/Ryujinx.Graphics.Gpu/State/ReportCounterType.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Counter type for GPU counter reporting. - /// </summary> - enum ReportCounterType - { - Zero = 0, - InputVertices = 1, - InputPrimitives = 3, - VertexShaderInvocations = 5, - GeometryShaderInvocations = 7, - GeometryShaderPrimitives = 9, - ZcullStats0 = 0xa, - TransformFeedbackPrimitivesWritten = 0xb, - ZcullStats1 = 0xc, - ZcullStats2 = 0xe, - ClipperInputPrimitives = 0xf, - ZcullStats3 = 0x10, - ClipperOutputPrimitives = 0x11, - PrimitivesGenerated = 0x12, - FragmentShaderInvocations = 0x13, - SamplesPassed = 0x15, - TransformFeedbackOffset = 0x1a, - TessControlShaderInvocations = 0x1b, - TessEvaluationShaderInvocations = 0x1d, - TessEvaluationShaderPrimitives = 0x1f - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/ResetCounterType.cs b/Ryujinx.Graphics.Gpu/State/ResetCounterType.cs deleted file mode 100644 index aaf575e1..00000000 --- a/Ryujinx.Graphics.Gpu/State/ResetCounterType.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Counter type for GPU counter reset. - /// </summary> - enum ResetCounterType - { - SamplesPassed = 1, - ZcullStats = 2, - TransformFeedbackPrimitivesWritten = 0x10, - InputVertices = 0x12, - InputPrimitives = 0x13, - VertexShaderInvocations = 0x15, - TessControlShaderInvocations = 0x16, - TessEvaluationShaderInvocations = 0x17, - TessEvaluationShaderPrimitives = 0x18, - GeometryShaderInvocations = 0x1a, - GeometryShaderPrimitives = 0x1b, - ClipperInputPrimitives = 0x1c, - ClipperOutputPrimitives = 0x1d, - FragmentShaderInvocations = 0x1e, - PrimitivesGenerated = 0x1f - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/RtColorMask.cs b/Ryujinx.Graphics.Gpu/State/RtColorMask.cs deleted file mode 100644 index 3567bf37..00000000 --- a/Ryujinx.Graphics.Gpu/State/RtColorMask.cs +++ /dev/null @@ -1,49 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Render target color buffer mask. - /// This defines which color channels are written to the color buffer. - /// </summary> - struct RtColorMask - { -#pragma warning disable CS0649 - public uint Packed; -#pragma warning restore CS0649 - - /// <summary> - /// Unpacks red channel enable. - /// </summary> - /// <returns>True to write the new red channel color, false to keep the old value</returns> - public bool UnpackRed() - { - return (Packed & 0x1) != 0; - } - - /// <summary> - /// Unpacks green channel enable. - /// </summary> - /// <returns>True to write the new green channel color, false to keep the old value</returns> - public bool UnpackGreen() - { - return (Packed & 0x10) != 0; - } - - /// <summary> - /// Unpacks blue channel enable. - /// </summary> - /// <returns>True to write the new blue channel color, false to keep the old value</returns> - public bool UnpackBlue() - { - return (Packed & 0x100) != 0; - } - - /// <summary> - /// Unpacks alpha channel enable. - /// </summary> - /// <returns>True to write the new alpha channel color, false to keep the old value</returns> - public bool UnpackAlpha() - { - return (Packed & 0x1000) != 0; - } - } -} diff --git a/Ryujinx.Graphics.Gpu/State/RtColorState.cs b/Ryujinx.Graphics.Gpu/State/RtColorState.cs deleted file mode 100644 index 457725ff..00000000 --- a/Ryujinx.Graphics.Gpu/State/RtColorState.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Render target color buffer state. - /// </summary> - struct RtColorState - { -#pragma warning disable CS0649 - public GpuVa Address; - public int WidthOrStride; - public int Height; - public ColorFormat Format; - 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; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/RtControl.cs b/Ryujinx.Graphics.Gpu/State/RtControl.cs deleted file mode 100644 index 8b6b1867..00000000 --- a/Ryujinx.Graphics.Gpu/State/RtControl.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Render target draw buffers control. - /// </summary> - struct RtControl - { -#pragma warning disable CS0649 - public uint Packed; -#pragma warning restore CS0649 - - /// <summary> - /// Unpacks the number of active draw buffers. - /// </summary> - /// <returns>Number of active draw buffers</returns> - public int UnpackCount() - { - return (int)(Packed & 0xf); - } - - /// <summary> - /// Unpacks the color attachment index for a given draw buffer. - /// </summary> - /// <param name="index">Index of the draw buffer</param> - /// <returns>Attachment index</returns> - public int UnpackPermutationIndex(int index) - { - return (int)((Packed >> (4 + index * 3)) & 7); - } - } -} diff --git a/Ryujinx.Graphics.Gpu/State/RtDepthStencilState.cs b/Ryujinx.Graphics.Gpu/State/RtDepthStencilState.cs deleted file mode 100644 index 3886f58c..00000000 --- a/Ryujinx.Graphics.Gpu/State/RtDepthStencilState.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Render target depth-stencil buffer state. - /// </summary> - struct RtDepthStencilState - { -#pragma warning disable CS0649 - public GpuVa Address; - public ZetaFormat Format; - public MemoryLayout MemoryLayout; - public int LayerSize; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/SamplerIndex.cs b/Ryujinx.Graphics.Gpu/State/SamplerIndex.cs deleted file mode 100644 index c2aaff43..00000000 --- a/Ryujinx.Graphics.Gpu/State/SamplerIndex.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Sampler pool indexing mode. - /// </summary> - enum SamplerIndex - { - Independently = 0, - ViaHeaderIndex = 1 - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/SbDescriptor.cs b/Ryujinx.Graphics.Gpu/State/SbDescriptor.cs deleted file mode 100644 index 9723b719..00000000 --- a/Ryujinx.Graphics.Gpu/State/SbDescriptor.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Storage buffer address and size information. - /// </summary> - struct SbDescriptor - { -#pragma warning disable CS0649 - public uint AddressLow; - public uint AddressHigh; - public int Size; - public int Padding; -#pragma warning restore CS0649 - - public ulong PackAddress() - { - return AddressLow | ((ulong)AddressHigh << 32); - } - } -} diff --git a/Ryujinx.Graphics.Gpu/State/ScissorState.cs b/Ryujinx.Graphics.Gpu/State/ScissorState.cs deleted file mode 100644 index 4f4b02dc..00000000 --- a/Ryujinx.Graphics.Gpu/State/ScissorState.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - struct ScissorState - { -#pragma warning disable CS0649 - public Boolean32 Enable; - public ushort X1; - public ushort X2; - public ushort Y1; - public ushort Y2; - public uint Padding; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/ScreenScissorState.cs b/Ryujinx.Graphics.Gpu/State/ScreenScissorState.cs deleted file mode 100644 index 2fbf9934..00000000 --- a/Ryujinx.Graphics.Gpu/State/ScreenScissorState.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - struct ScreenScissorState - { -#pragma warning disable CS0649 - public ushort X; - public ushort Width; - public ushort Y; - public ushort Height; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/SemaphoreOperation.cs b/Ryujinx.Graphics.Gpu/State/SemaphoreOperation.cs deleted file mode 100644 index 67f3c127..00000000 --- a/Ryujinx.Graphics.Gpu/State/SemaphoreOperation.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// GPU semaphore operation. - /// </summary> - enum SemaphoreOperation - { - Release = 0, - Acquire = 1, - Counter = 2 - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/SemaphoreState.cs b/Ryujinx.Graphics.Gpu/State/SemaphoreState.cs deleted file mode 100644 index bfc5720a..00000000 --- a/Ryujinx.Graphics.Gpu/State/SemaphoreState.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// GPU semaphore state. - /// </summary> - struct SemaphoreState - { -#pragma warning disable CS0649 - public GpuVa Address; - public int Payload; - public uint Control; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/ShaderState.cs b/Ryujinx.Graphics.Gpu/State/ShaderState.cs deleted file mode 100644 index 4cf67c74..00000000 --- a/Ryujinx.Graphics.Gpu/State/ShaderState.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Graphics shader stage state. - /// </summary> - struct ShaderState - { -#pragma warning disable CS0649 - public uint Control; - public uint Offset; - public uint Unknown0x8; - public int MaxRegisters; - public ShaderType Type; - 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; -#pragma warning restore CS0649 - - /// <summary> - /// Unpacks shader enable information. - /// Must be ignored for vertex shaders, those are always enabled. - /// </summary> - /// <returns>True if the stage is enabled, false otherwise</returns> - public bool UnpackEnable() - { - return (Control & 1) != 0; - } - } -} diff --git a/Ryujinx.Graphics.Gpu/State/ShaderType.cs b/Ryujinx.Graphics.Gpu/State/ShaderType.cs deleted file mode 100644 index 58506821..00000000 --- a/Ryujinx.Graphics.Gpu/State/ShaderType.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Shader stage name. - /// </summary> - enum ShaderType - { - Vertex, - TessellationControl, - TessellationEvaluation, - Geometry, - Fragment - } -} diff --git a/Ryujinx.Graphics.Gpu/State/Size3D.cs b/Ryujinx.Graphics.Gpu/State/Size3D.cs deleted file mode 100644 index 1c127da6..00000000 --- a/Ryujinx.Graphics.Gpu/State/Size3D.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// 3D, 2D or 1D texture size. - /// </summary> - struct Size3D - { -#pragma warning disable CS0649 - public int Width; - public int Height; - public int Depth; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/StencilBackMasks.cs b/Ryujinx.Graphics.Gpu/State/StencilBackMasks.cs deleted file mode 100644 index 49061cc5..00000000 --- a/Ryujinx.Graphics.Gpu/State/StencilBackMasks.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Stencil test masks for back tests. - /// </summary> - struct StencilBackMasks - { -#pragma warning disable CS0649 - public int FuncRef; - public int Mask; - public int FuncMask; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/StencilBackTestState.cs b/Ryujinx.Graphics.Gpu/State/StencilBackTestState.cs deleted file mode 100644 index 16655322..00000000 --- a/Ryujinx.Graphics.Gpu/State/StencilBackTestState.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Ryujinx.Graphics.GAL; - -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Stencil back test state. - /// </summary> - struct StencilBackTestState - { -#pragma warning disable CS0649 - public Boolean32 TwoSided; - public StencilOp BackSFail; - public StencilOp BackDpFail; - public StencilOp BackDpPass; - public CompareOp BackFunc; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/StencilTestState.cs b/Ryujinx.Graphics.Gpu/State/StencilTestState.cs deleted file mode 100644 index 72f85f2b..00000000 --- a/Ryujinx.Graphics.Gpu/State/StencilTestState.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Ryujinx.Graphics.GAL; - -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Stencil front test state and masks. - /// </summary> - struct StencilTestState - { -#pragma warning disable CS0649 - public Boolean32 Enable; - public StencilOp FrontSFail; - public StencilOp FrontDpFail; - public StencilOp FrontDpPass; - public CompareOp FrontFunc; - public int FrontFuncRef; - public int FrontFuncMask; - public int FrontMask; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/TfBufferState.cs b/Ryujinx.Graphics.Gpu/State/TfBufferState.cs deleted file mode 100644 index 24dc0952..00000000 --- a/Ryujinx.Graphics.Gpu/State/TfBufferState.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Transform feedback buffer state. - /// </summary> - struct TfBufferState - { -#pragma warning disable CS0649 - public Boolean32 Enable; - public GpuVa Address; - public int Size; - public int Offset; - public uint Padding0; - public uint Padding1; - public uint Padding2; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/TfState.cs b/Ryujinx.Graphics.Gpu/State/TfState.cs deleted file mode 100644 index fb8b950b..00000000 --- a/Ryujinx.Graphics.Gpu/State/TfState.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Transform feedback state. - /// </summary> - struct TfState - { -#pragma warning disable CS0649 - public int BufferIndex; - public int VaryingsCount; - public int Stride; - public uint Padding; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/UniformBufferState.cs b/Ryujinx.Graphics.Gpu/State/UniformBufferState.cs deleted file mode 100644 index d547ea82..00000000 --- a/Ryujinx.Graphics.Gpu/State/UniformBufferState.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Uniform buffer state for the uniform buffer currently being modified. - /// </summary> - struct UniformBufferState - { -#pragma warning disable CS0649 - public int Size; - public GpuVa Address; - public int Offset; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/VertexAttribState.cs b/Ryujinx.Graphics.Gpu/State/VertexAttribState.cs deleted file mode 100644 index dbb75a5b..00000000 --- a/Ryujinx.Graphics.Gpu/State/VertexAttribState.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Vertex buffer attribute state. - /// </summary> - struct VertexAttribState - { -#pragma warning disable CS0649 - public uint Attribute; -#pragma warning restore CS0649 - - /// <summary> - /// Unpacks the index of the vertex buffer this attribute belongs to. - /// </summary> - /// <returns>Vertex buffer index</returns> - public int UnpackBufferIndex() - { - return (int)(Attribute & 0x1f); - } - - /// <summary> - /// Unpacks the attribute constant flag. - /// </summary> - /// <returns>True if the attribute is constant, false otherwise</returns> - public bool UnpackIsConstant() - { - return (Attribute & 0x40) != 0; - } - - /// <summary> - /// Unpacks the offset, in bytes, of the attribute on the vertex buffer. - /// </summary> - /// <returns>Attribute offset in bytes</returns> - public int UnpackOffset() - { - return (int)((Attribute >> 7) & 0x3fff); - } - - /// <summary> - /// Unpacks the Maxwell attribute format integer. - /// </summary> - /// <returns>Attribute format integer</returns> - public uint UnpackFormat() - { - return Attribute & 0x3fe00000; - } - } -} diff --git a/Ryujinx.Graphics.Gpu/State/VertexBufferDrawState.cs b/Ryujinx.Graphics.Gpu/State/VertexBufferDrawState.cs deleted file mode 100644 index 3e11838a..00000000 --- a/Ryujinx.Graphics.Gpu/State/VertexBufferDrawState.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Draw state for non-indexed draws. - /// </summary> - struct VertexBufferDrawState - { -#pragma warning disable CS0649 - public int First; - public int Count; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/VertexBufferState.cs b/Ryujinx.Graphics.Gpu/State/VertexBufferState.cs deleted file mode 100644 index 85176d82..00000000 --- a/Ryujinx.Graphics.Gpu/State/VertexBufferState.cs +++ /dev/null @@ -1,32 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Vertex buffer state. - /// </summary> - struct VertexBufferState - { -#pragma warning disable CS0649 - public uint Control; - public GpuVa Address; - public int Divisor; -#pragma warning restore CS0649 - - /// <summary> - /// Vertex buffer stride, defined as the number of bytes occupied by each vertex in memory. - /// </summary> - /// <returns>Vertex buffer stride</returns> - public int UnpackStride() - { - return (int)(Control & 0xfff); - } - - /// <summary> - /// Vertex buffer enable. - /// </summary> - /// <returns>True if the vertex buffer is enabled, false otherwise</returns> - public bool UnpackEnable() - { - return (Control & (1 << 12)) != 0; - } - } -} diff --git a/Ryujinx.Graphics.Gpu/State/ViewVolumeClipControl.cs b/Ryujinx.Graphics.Gpu/State/ViewVolumeClipControl.cs deleted file mode 100644 index ace8342c..00000000 --- a/Ryujinx.Graphics.Gpu/State/ViewVolumeClipControl.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace Ryujinx.Graphics.Gpu.State -{ - [Flags] - enum ViewVolumeClipControl - { - ForceDepthRangeZeroToOne = 1 << 0, - DepthClampDisabled = 1 << 11, - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/ViewportExtents.cs b/Ryujinx.Graphics.Gpu/State/ViewportExtents.cs deleted file mode 100644 index d7728f41..00000000 --- a/Ryujinx.Graphics.Gpu/State/ViewportExtents.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Viewport extents for viewport clipping, also includes depth range. - /// </summary> - struct ViewportExtents - { -#pragma warning disable CS0649 - public ushort X; - public ushort Width; - public ushort Y; - public ushort Height; - public float DepthNear; - public float DepthFar; -#pragma warning restore CS0649 - } -} diff --git a/Ryujinx.Graphics.Gpu/State/ViewportTransform.cs b/Ryujinx.Graphics.Gpu/State/ViewportTransform.cs deleted file mode 100644 index b795ea15..00000000 --- a/Ryujinx.Graphics.Gpu/State/ViewportTransform.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Ryujinx.Graphics.GAL; - -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Viewport transform parameters, for viewport transformation. - /// </summary> - struct ViewportTransform - { -#pragma warning disable CS0649 - public float ScaleX; - public float ScaleY; - public float ScaleZ; - public float TranslateX; - public float TranslateY; - public float TranslateZ; - public uint Swizzle; - public uint SubpixelPrecisionBias; -#pragma warning restore CS0649 - - /// <summary> - /// Unpacks viewport swizzle of the position X component. - /// </summary> - /// <returns>Swizzle enum value</returns> - public ViewportSwizzle UnpackSwizzleX() - { - return (ViewportSwizzle)(Swizzle & 7); - } - - /// <summary> - /// Unpacks viewport swizzle of the position Y component. - /// </summary> - /// <returns>Swizzle enum value</returns> - public ViewportSwizzle UnpackSwizzleY() - { - return (ViewportSwizzle)((Swizzle >> 4) & 7); - } - - /// <summary> - /// Unpacks viewport swizzle of the position Z component. - /// </summary> - /// <returns>Swizzle enum value</returns> - public ViewportSwizzle UnpackSwizzleZ() - { - return (ViewportSwizzle)((Swizzle >> 8) & 7); - } - - /// <summary> - /// Unpacks viewport swizzle of the position W component. - /// </summary> - /// <returns>Swizzle enum value</returns> - public ViewportSwizzle UnpackSwizzleW() - { - return (ViewportSwizzle)((Swizzle >> 12) & 7); - } - } -} diff --git a/Ryujinx.Graphics.Gpu/State/YControl.cs b/Ryujinx.Graphics.Gpu/State/YControl.cs deleted file mode 100644 index 58e000d9..00000000 --- a/Ryujinx.Graphics.Gpu/State/YControl.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace Ryujinx.Graphics.Gpu.State -{ - [Flags] - enum YControl - { - NegateY = 1 << 0, - TriangleRastFlip = 1 << 4 - } -}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/State/ZetaFormat.cs b/Ryujinx.Graphics.Gpu/State/ZetaFormat.cs deleted file mode 100644 index 01b608b3..00000000 --- a/Ryujinx.Graphics.Gpu/State/ZetaFormat.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Ryujinx.Graphics.GAL; -using Ryujinx.Graphics.Gpu.Image; - -namespace Ryujinx.Graphics.Gpu.State -{ - /// <summary> - /// Depth-stencil texture format. - /// </summary> - enum ZetaFormat - { - D32Float = 0xa, - D16Unorm = 0x13, - D24UnormS8Uint = 0x14, - D24Unorm = 0x15, - S8UintD24Unorm = 0x16, - S8Uint = 0x17, - D32FloatS8Uint = 0x19 - } - - static class ZetaFormatConverter - { - /// <summary> - /// Converts the depth-stencil texture format to a host compatible format. - /// </summary> - /// <param name="format">Depth-stencil format</param> - /// <returns>Host compatible format enum value</returns> - public static FormatInfo Convert(this ZetaFormat format) - { - return format switch - { - ZetaFormat.D32Float => new FormatInfo(Format.D32Float, 1, 1, 4, 1), - ZetaFormat.D16Unorm => new FormatInfo(Format.D16Unorm, 1, 1, 2, 1), - ZetaFormat.D24UnormS8Uint => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4, 2), - ZetaFormat.D24Unorm => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4, 1), - ZetaFormat.S8UintD24Unorm => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4, 2), - ZetaFormat.S8Uint => new FormatInfo(Format.S8Uint, 1, 1, 1, 1), - ZetaFormat.D32FloatS8Uint => new FormatInfo(Format.D32FloatS8Uint, 1, 1, 8, 2), - _ => FormatInfo.Default - }; - } - } -} |
