aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/State
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2019-12-06 19:37:00 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commitcb171f6ebfa7e1aa5721503d1c1115719957932d (patch)
tree20de7fca78819fe436fbde629544aa547f446cc8 /Ryujinx.Graphics.Gpu/State
parente25b7c9848b6ec486eb513297b5c536857665c7f (diff)
Support shared color mask, implement more shader instructions
Support shared color masks (used by Nouveau and maybe the NVIDIA driver). Support draw buffers (also required by OpenGL). Support viewport transform disable (disabled for now as it breaks some games). Fix instanced rendering draw being ignored for multi draw. Fix IADD and IADD3 immediate shader encodings, that was not matching some ops. Implement FFMA32I shader instruction. Implement IMAD shader instruction.
Diffstat (limited to 'Ryujinx.Graphics.Gpu/State')
-rw-r--r--Ryujinx.Graphics.Gpu/State/GpuState.cs8
-rw-r--r--Ryujinx.Graphics.Gpu/State/MethodOffset.cs3
-rw-r--r--Ryujinx.Graphics.Gpu/State/RtControl.cs17
3 files changed, 27 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Gpu/State/GpuState.cs b/Ryujinx.Graphics.Gpu/State/GpuState.cs
index 13f777c9..509f6715 100644
--- a/Ryujinx.Graphics.Gpu/State/GpuState.cs
+++ b/Ryujinx.Graphics.Gpu/State/GpuState.cs
@@ -94,11 +94,17 @@ namespace Ryujinx.Graphics.Gpu.State
_backingMemory[(int)MethodOffset.ViewportExtents + index * 4 + 3] = 0x3F800000;
}
+ // Viewport transform enable.
+ _backingMemory[(int)MethodOffset.ViewportTransformEnable] = 1;
+
// Default front stencil mask.
_backingMemory[0x4e7] = 0xff;
// Default color mask.
- _backingMemory[(int)MethodOffset.RtColorMask] = 0x1111;
+ for (int index = 0; index < Constants.TotalRenderTargets; index++)
+ {
+ _backingMemory[(int)MethodOffset.RtColorMask + index] = 0x1111;
+ }
}
public void RegisterCallback(MethodOffset offset, int count, MethodCallback callback)
diff --git a/Ryujinx.Graphics.Gpu/State/MethodOffset.cs b/Ryujinx.Graphics.Gpu/State/MethodOffset.cs
index a560c257..93cd6f06 100644
--- a/Ryujinx.Graphics.Gpu/State/MethodOffset.cs
+++ b/Ryujinx.Graphics.Gpu/State/MethodOffset.cs
@@ -29,8 +29,10 @@ namespace Ryujinx.Graphics.Gpu.State
StencilBackMasks = 0x3d5,
InvalidateTextures = 0x3dd,
TextureBarrierTiled = 0x3df,
+ RtColorMaskShared = 0x3e4,
RtDepthStencilState = 0x3f8,
VertexAttribState = 0x458,
+ RtControl = 0x487,
RtDepthStencilSize = 0x48a,
SamplerIndex = 0x48d,
DepthTestEnable = 0x4b3,
@@ -62,6 +64,7 @@ namespace Ryujinx.Graphics.Gpu.State
DepthBiasClamp = 0x61f,
VertexBufferInstanced = 0x620,
FaceState = 0x646,
+ ViewportTransformEnable = 0x64b,
Clear = 0x674,
RtColorMask = 0x680,
ReportState = 0x6c0,
diff --git a/Ryujinx.Graphics.Gpu/State/RtControl.cs b/Ryujinx.Graphics.Gpu/State/RtControl.cs
new file mode 100644
index 00000000..4c6fbc34
--- /dev/null
+++ b/Ryujinx.Graphics.Gpu/State/RtControl.cs
@@ -0,0 +1,17 @@
+namespace Ryujinx.Graphics.Gpu.State
+{
+ struct RtControl
+ {
+ public uint Packed;
+
+ public int UnpackCount()
+ {
+ return (int)(Packed & 0xf);
+ }
+
+ public int UnpackPermutationIndex(int index)
+ {
+ return (int)((Packed >> (4 + index * 3)) & 7);
+ }
+ }
+}