diff options
| author | mageven <62494521+mageven@users.noreply.github.com> | 2020-04-07 14:49:45 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-07 19:19:45 +1000 |
| commit | 468d8f841ffcbebf4130371eb64ab04165bce3e9 (patch) | |
| tree | cc3dd0cf370f7ae3d80720a4324baf954560a8d4 /Ryujinx.Graphics.OpenGL/Pipeline.cs | |
| parent | e99e6d0ad1fb0e0245469a67526de2dc03bc0658 (diff) | |
Simple GPU fixes (#1093)
* Implement RasterizeEnable
* Match viewport count to hardware
* Simplify ScissorTest tracking around Blits
* Disable RasterizerDiscard around Blits and track its state
* Read RasterizeEnable reg as bool and add doc
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Pipeline.cs')
| -rw-r--r-- | Ryujinx.Graphics.OpenGL/Pipeline.cs | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Pipeline.cs b/Ryujinx.Graphics.OpenGL/Pipeline.cs index 3480cf82..aef3383b 100644 --- a/Ryujinx.Graphics.OpenGL/Pipeline.cs +++ b/Ryujinx.Graphics.OpenGL/Pipeline.cs @@ -10,6 +10,8 @@ namespace Ryujinx.Graphics.OpenGL { private Program _program; + private bool _rasterizerDiscard; + private VertexArray _vertexArray; private Framebuffer _framebuffer; @@ -31,14 +33,13 @@ namespace Ryujinx.Graphics.OpenGL private uint[] _componentMasks; - private readonly bool[] _scissorEnable; + private bool _scissor0Enable = false; internal Pipeline() { + _rasterizerDiscard = false; _clipOrigin = ClipOrigin.LowerLeft; _clipDepthMode = ClipDepthMode.NegativeOneToOne; - - _scissorEnable = new bool[8]; } public void Barrier() @@ -644,6 +645,20 @@ namespace Ryujinx.Graphics.OpenGL _program.Bind(); } + public void SetRasterizerDiscard(bool discard) + { + if (discard) + { + GL.Enable(EnableCap.RasterizerDiscard); + } + else + { + GL.Disable(EnableCap.RasterizerDiscard); + } + + _rasterizerDiscard = discard; + } + public void SetRenderTargetColorMasks(uint[] componentMasks) { _componentMasks = (uint[])componentMasks.Clone(); @@ -697,7 +712,10 @@ namespace Ryujinx.Graphics.OpenGL GL.Disable(IndexedEnableCap.ScissorTest, index); } - _scissorEnable[index] = enable; + if (index == 0) + { + _scissor0Enable = enable; + } } public void SetScissor(int index, int x, int y, int width, int height) @@ -959,14 +977,19 @@ namespace Ryujinx.Graphics.OpenGL } } - public void RestoreScissorEnable() + public void RestoreScissor0Enable() { - for (int index = 0; index < 8; index++) + if (_scissor0Enable) { - if (_scissorEnable[index]) - { - GL.Enable(IndexedEnableCap.ScissorTest, index); - } + GL.Enable(IndexedEnableCap.ScissorTest, 0); + } + } + + public void RestoreRasterizerDiscard() + { + if (_rasterizerDiscard) + { + GL.Enable(EnableCap.RasterizerDiscard); } } |
