1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-12 04:52:02 +00:00

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
This commit is contained in:
gdkchan 2021-12-28 08:37:23 -03:00 committed by GitHub
parent 6dacc4c577
commit ef39b2ebdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,7 +64,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
nameof(ThreedClassState.ShaderState)), nameof(ThreedClassState.ShaderState)),
new StateUpdateCallbackEntry(UpdateRasterizerState, nameof(ThreedClassState.RasterizeEnable)), new StateUpdateCallbackEntry(UpdateRasterizerState, nameof(ThreedClassState.RasterizeEnable)),
new StateUpdateCallbackEntry(UpdateScissorState, nameof(ThreedClassState.ScissorState)),
new StateUpdateCallbackEntry(UpdateScissorState,
nameof(ThreedClassState.ScissorState),
nameof(ThreedClassState.ScreenScissorState)),
new StateUpdateCallbackEntry(UpdateVertexBufferState, new StateUpdateCallbackEntry(UpdateVertexBufferState,
nameof(ThreedClassState.VertexBufferDrawState), nameof(ThreedClassState.VertexBufferDrawState),
@ -426,6 +429,18 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
int width = scissor.X2 - x; int width = scissor.X2 - x;
int height = scissor.Y2 - y; 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; float scale = _channel.TextureManager.RenderTargetScale;
if (scale != 1f) if (scale != 1f)
{ {