diff options
author | mageven <62494521+mageven@users.noreply.github.com> | 2020-05-04 07:34:49 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-04 12:04:49 +1000 |
commit | 53369e79bdc34440a48e932e7024bab92f30f957 (patch) | |
tree | 43ddc5f5d334f22933691d4bf5aa9c45fcac9636 /Ryujinx.Graphics.Gpu/Engine/Methods.cs | |
parent | 12399b8aeac82b8f80a06dbcb59a8021908d9c30 (diff) |
Implement user-defined clipping on GL state pipeline (#1118)
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/Methods.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Engine/Methods.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Methods.cs b/Ryujinx.Graphics.Gpu/Engine/Methods.cs index a517ae05..59678be5 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Methods.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Methods.cs @@ -125,6 +125,11 @@ namespace Ryujinx.Graphics.Gpu.Engine UpdateShaderState(state); } + if (state.QueryModified(MethodOffset.ClipDistanceEnable)) + { + UpdateUserClipState(state); + } + if (state.QueryModified(MethodOffset.RasterizeEnable)) { UpdateRasterizerState(state); @@ -903,6 +908,20 @@ namespace Ryujinx.Graphics.Gpu.Engine } /// <summary> + /// Updates user-defined clipping based on the guest GPU state. + /// </summary> + /// <param name="state">Current GPU state</param> + private void UpdateUserClipState(GpuState state) + { + int clipMask = state.Get<int>(MethodOffset.ClipDistanceEnable); + + for (int i = 0; i < Constants.TotalClipDistances; ++i) + { + _context.Renderer.Pipeline.SetUserClipDistance(i, (clipMask & (1 << i)) != 0); + } + } + + /// <summary> /// Gets texture target from a sampler type. /// </summary> /// <param name="type">Sampler type</param> |