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.OpenGL/Pipeline.cs | |
parent | 06bf25521ff3ab2ad82eb49cde2bb6f90324caa2 (diff) |
Implement GPU scissors (#1058)
* Implement GPU scissors
* Remove unused using
* Add missing changes for Clear
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Pipeline.cs')
-rw-r--r-- | Ryujinx.Graphics.OpenGL/Pipeline.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Pipeline.cs b/Ryujinx.Graphics.OpenGL/Pipeline.cs index c2a42370..f01e7c7a 100644 --- a/Ryujinx.Graphics.OpenGL/Pipeline.cs +++ b/Ryujinx.Graphics.OpenGL/Pipeline.cs @@ -31,10 +31,14 @@ namespace Ryujinx.Graphics.OpenGL private uint[] _componentMasks; + private readonly bool[] _scissorEnable; + internal Pipeline() { _clipOrigin = ClipOrigin.LowerLeft; _clipDepthMode = ClipDepthMode.NegativeOneToOne; + + _scissorEnable = new bool[8]; } public void Barrier() @@ -674,6 +678,25 @@ namespace Ryujinx.Graphics.OpenGL } } + public void SetScissorEnable(int index, bool enable) + { + if (enable) + { + GL.Enable(IndexedEnableCap.ScissorTest, index); + } + else + { + GL.Disable(IndexedEnableCap.ScissorTest, index); + } + + _scissorEnable[index] = enable; + } + + public void SetScissor(int index, int x, int y, int width, int height) + { + GL.ScissorIndexed(index, x, y, width, height); + } + public void SetStencilTest(StencilTestDescriptor stencilTest) { if (!stencilTest.TestEnable) @@ -928,6 +951,17 @@ namespace Ryujinx.Graphics.OpenGL } } + public void RestoreScissorEnable() + { + for (int index = 0; index < 8; index++) + { + if (_scissorEnable[index]) + { + GL.Enable(IndexedEnableCap.ScissorTest, index); + } + } + } + public void Dispose() { _framebuffer?.Dispose(); |