From 1b77002c7e25aeae401a537d1ebf7b1ebe616123 Mon Sep 17 00:00:00 2001 From: Andy Adshead Date: Sun, 6 Jan 2019 02:35:10 +0000 Subject: [PATCH] Correct height calculation --- Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs index c098369607..9a22c85f42 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs @@ -24,6 +24,9 @@ namespace Ryujinx.Graphics.Graphics3d private ConstBuffer[][] ConstBuffers; + // Height kept for flipping y axis + private int ViewportHeight = 0; + private int CurrentInstance = 0; public NvGpuEngine3d(NvGpu Gpu) @@ -209,6 +212,8 @@ namespace Ryujinx.Graphics.Graphics3d Gpu.ResourceManager.SendColorBuffer(Vmm, Key, FbIndex, Image); + ViewportHeight = VpH; + Gpu.Renderer.RenderTarget.SetViewport(FbIndex, VpX, VpY, VpW, VpH); } @@ -410,8 +415,6 @@ namespace Ryujinx.Graphics.Graphics3d private void SetScissor(GalPipelineState State) { - int Height = ReadRegister(NvGpuEngine3dReg.FrameBufferNHeight); - // FIXME: Stubbed, only the first scissor test is valid without a geometry shader loaded. At time of writing geometry shaders are also stubbed. // Once geometry shaders are fixed it should be equal to GalPipelineState.RenderTargetCount when shader loaded, otherwise equal to 1 State.ScissorTestCount = 1; @@ -434,7 +437,7 @@ namespace Ryujinx.Graphics.Graphics3d // Y coordinates may have to be flipped if ((int)State.FlipY == -1) { - State.ScissorTestY[Index] = Height - State.ScissorTestY[Index] - State.ScissorTestHeight[Index]; + State.ScissorTestY[Index] = ViewportHeight - State.ScissorTestY[Index] - State.ScissorTestHeight[Index]; } } }