aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2020-11-12 23:40:26 +0000
committerGitHub <noreply@github.com>2020-11-13 10:40:26 +1100
commitc6524942199eca97d3f9bd9e2e18a21b14069a8c (patch)
treefe05f647f7efa8abd6860880f2bca624c742adef
parent48f6570557fc76496936514d94e3ccddf55ec633 (diff)
Use "Screen Scissor" as size hint for render targets (#1703)
"Screen scissor" is the minimum size of all render targets, and is set when any render target is bound on NVN or OpenGL. Since it works on all active texture's real sizes, it is therefore more reliable than viewport 0's width, and is actually set before clear. This fixes a regression with Hyrule Warriors: Age Of Calamity's cubemaps, which did not set viewport dimensions before clear. This resulted in attempting to create a cubemap with rectangular sides, which is logically and physically impossible. (also it just fails)
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/Methods.cs4
-rw-r--r--Ryujinx.Graphics.Gpu/State/MethodOffset.cs1
-rw-r--r--Ryujinx.Graphics.Gpu/State/ScreenScissorState.cs12
3 files changed, 15 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Methods.cs b/Ryujinx.Graphics.Gpu/Engine/Methods.cs
index f408561a..9f27aec2 100644
--- a/Ryujinx.Graphics.Gpu/Engine/Methods.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/Methods.cs
@@ -355,8 +355,8 @@ namespace Ryujinx.Graphics.Gpu.Engine
int samplesInX = msaaMode.SamplesInX();
int samplesInY = msaaMode.SamplesInY();
- var extents = state.Get<ViewportExtents>(MethodOffset.ViewportExtents, 0);
- Size sizeHint = new Size(extents.X + extents.Width, extents.Y + extents.Height, 1);
+ var scissor = state.Get<ScreenScissorState>(MethodOffset.ScreenScissorState);
+ Size sizeHint = new Size(scissor.X + scissor.Width, scissor.Y + scissor.Height, 1);
bool changedScale = false;
diff --git a/Ryujinx.Graphics.Gpu/State/MethodOffset.cs b/Ryujinx.Graphics.Gpu/State/MethodOffset.cs
index 8d2df79a..3293ae8e 100644
--- a/Ryujinx.Graphics.Gpu/State/MethodOffset.cs
+++ b/Ryujinx.Graphics.Gpu/State/MethodOffset.cs
@@ -45,6 +45,7 @@ namespace Ryujinx.Graphics.Gpu.State
TextureBarrierTiled = 0x3df,
RtColorMaskShared = 0x3e4,
RtDepthStencilState = 0x3f8,
+ ScreenScissorState = 0x3fd,
VertexAttribState = 0x458,
RtControl = 0x487,
RtDepthStencilSize = 0x48a,
diff --git a/Ryujinx.Graphics.Gpu/State/ScreenScissorState.cs b/Ryujinx.Graphics.Gpu/State/ScreenScissorState.cs
new file mode 100644
index 00000000..2fbf9934
--- /dev/null
+++ b/Ryujinx.Graphics.Gpu/State/ScreenScissorState.cs
@@ -0,0 +1,12 @@
+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
+ }
+}