diff options
author | gdkchan <gab.dark.100@gmail.com> | 2020-03-29 00:02:58 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-29 14:02:58 +1100 |
commit | ab4867505ec0d3f5a9ec4f042ccd6f7890e3632e (patch) | |
tree | b3956fc821e0dcb8c8c3edc9dcae5eadf83ce29d /Ryujinx.Graphics.Gpu/Engine/Methods.cs | |
parent | 06bf25521ff3ab2ad82eb49cde2bb6f90324caa2 (diff) |
Implement GPU scissors (#1058)
* Implement GPU scissors
* Remove unused using
* Add missing changes for Clear
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/Methods.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Engine/Methods.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Methods.cs b/Ryujinx.Graphics.Gpu/Engine/Methods.cs index a2c9876e..0b30e61d 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Methods.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Methods.cs @@ -117,6 +117,11 @@ namespace Ryujinx.Graphics.Gpu.Engine UpdateRenderTargetState(state, useControl: true); } + if (state.QueryModified(MethodOffset.ScissorState)) + { + UpdateScissorState(state); + } + if (state.QueryModified(MethodOffset.DepthTestEnable, MethodOffset.DepthWriteEnable, MethodOffset.DepthTestFunc)) @@ -322,6 +327,27 @@ namespace Ryujinx.Graphics.Gpu.Engine } /// <summary> + /// Updates host scissor test state based on current GPU state. + /// </summary> + /// <param name="state">Current GPU state</param> + private void UpdateScissorState(GpuState state) + { + for (int index = 0; index < Constants.TotalViewports; index++) + { + ScissorState scissor = state.Get<ScissorState>(MethodOffset.ScissorState, index); + + bool enable = scissor.Enable && (scissor.X1 != 0 || scissor.Y1 != 0 || scissor.X2 != 0xffff || scissor.Y2 != 0xffff); + + _context.Renderer.Pipeline.SetScissorEnable(index, enable); + + if (enable) + { + _context.Renderer.Pipeline.SetScissor(index, scissor.X1, scissor.Y1, scissor.X2 - scissor.X1, scissor.Y2 - scissor.Y1); + } + } + } + + /// <summary> /// Updates host depth test state based on current GPU state. /// </summary> /// <param name="state">Current GPU state</param> |