diff options
| author | BaronKiko <BaronKiko@users.noreply.github.com> | 2019-01-13 21:26:42 +0000 |
|---|---|---|
| committer | emmauss <emmausssss@gmail.com> | 2019-01-13 23:26:42 +0200 |
| commit | 0cd5ba03fe4cccd232cdb6aa7e8648b4a08a0ab1 (patch) | |
| tree | 0c90e2971779e3b7d7c937a5b7b949bbd209269b /Ryujinx.Graphics/Gal/OpenGL | |
| parent | 8406ec6272392a3f7f7672d85fdde333b6c70378 (diff) | |
Scissor test implementation. Partially stubbed until geometry shaders… (#556)
* Scissor test implementation. Partially stubbed until geometry shaders are fixed
* Apply to all viewports when geometry shaders are disabled.
* Also apply enable cap to all viewports when geometry shaders are disabled
* Added fixme as per suggestion
Co-Authored-By: BaronKiko <BaronKiko@users.noreply.github.com>
* Apparently no alignment needed here.
* Comment on new line
* Correct height calculation
Diffstat (limited to 'Ryujinx.Graphics/Gal/OpenGL')
| -rw-r--r-- | Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs index eb7f958b..e9143c19 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLPipeline.cs @@ -270,6 +270,57 @@ namespace Ryujinx.Graphics.Gal.OpenGL } } + + // Scissor Test + bool forceUpdate; + + for (int Index = 0; Index < New.ScissorTestCount; Index++) + { + forceUpdate = false; + + if (New.ScissorTestEnabled[Index] != Old.ScissorTestEnabled[Index]) + { + if (New.ScissorTestEnabled[Index]) + { + // If there is only 1 scissor test geometry shaders are disables so the scissor test applies to all viewports + if (New.ScissorTestCount == 1) + { + GL.Enable(EnableCap.ScissorTest); + } + else + { + GL.Enable(IndexedEnableCap.ScissorTest, Index); + } + forceUpdate = true; + } + else + { + GL.Disable(IndexedEnableCap.ScissorTest, Index); + } + } + + if (New.ScissorTestEnabled[Index] && + (New.ScissorTestX[Index] != Old.ScissorTestX[Index] || + New.ScissorTestY[Index] != Old.ScissorTestY[Index] || + New.ScissorTestWidth[Index] != Old.ScissorTestWidth[Index] || + New.ScissorTestHeight[Index] != Old.ScissorTestHeight[Index] || + forceUpdate)) // Force update intentionally last to reduce if comparisons + { + // If there is only 1 scissor test geometry shaders are disables so the scissor test applies to all viewports + if (New.ScissorTestCount == 1) + { + GL.Scissor(New.ScissorTestX[Index], New.ScissorTestY[Index], + New.ScissorTestWidth[Index], New.ScissorTestHeight[Index]); + } + else + { + GL.ScissorIndexed(Index, New.ScissorTestX[Index], New.ScissorTestY[Index], + New.ScissorTestWidth[Index], New.ScissorTestHeight[Index]); + } + } + } + + if (New.BlendIndependent) { for (int Index = 0; Index < GalPipelineState.RenderTargetsCount; Index++) |
