diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2021-12-28 08:37:23 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-28 08:37:23 -0300 |
| commit | ef39b2ebddb3d0f4c1d50a8dbffc6c434591b2dc (patch) | |
| tree | 0d24e84e34239aa6913a5fd00b58b55c67e60e83 | |
| parent | 6dacc4c577ed4ea81581e6d376630d0f6cc8250b (diff) | |
Flip scissor box when the YNegate bit is set (#2941)
* Flip scissor box when the YNegate bit is set
* Flip scissor based on screen scissor state, account for negative scissor Y
* No need for abs when we already know the value is negative
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs index cf74f649..9f6ee17c 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs @@ -64,7 +64,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed nameof(ThreedClassState.ShaderState)), new StateUpdateCallbackEntry(UpdateRasterizerState, nameof(ThreedClassState.RasterizeEnable)), - new StateUpdateCallbackEntry(UpdateScissorState, nameof(ThreedClassState.ScissorState)), + + new StateUpdateCallbackEntry(UpdateScissorState, + nameof(ThreedClassState.ScissorState), + nameof(ThreedClassState.ScreenScissorState)), new StateUpdateCallbackEntry(UpdateVertexBufferState, nameof(ThreedClassState.VertexBufferDrawState), @@ -426,6 +429,18 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed int width = scissor.X2 - x; int height = scissor.Y2 - y; + if (_state.State.YControl.HasFlag(YControl.NegateY)) + { + ref var screenScissor = ref _state.State.ScreenScissorState; + y = screenScissor.Height - height - y; + + if (y < 0) + { + height += y; + y = 0; + } + } + float scale = _channel.TextureManager.RenderTargetScale; if (scale != 1f) { |
