From b46b63e06a36845175f68331edb5ddeeb34de27b Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 5 Jul 2022 19:58:36 -0300 Subject: Add support for alpha to coverage dithering (#3069) * Add support for alpha to coverage dithering * Shader cache version bump * Fix wrong alpha register * Ensure support buffer is cleared * New shader specialization based approach --- Ryujinx.Graphics.GAL/Multithreading/CommandHelper.cs | 2 ++ Ryujinx.Graphics.GAL/Multithreading/CommandType.cs | 1 + .../Commands/SetMultisampleStateCommand.cs | 18 ++++++++++++++++++ .../Multithreading/ThreadedPipeline.cs | 6 ++++++ 4 files changed, 27 insertions(+) create mode 100644 Ryujinx.Graphics.GAL/Multithreading/Commands/SetMultisampleStateCommand.cs (limited to 'Ryujinx.Graphics.GAL/Multithreading') diff --git a/Ryujinx.Graphics.GAL/Multithreading/CommandHelper.cs b/Ryujinx.Graphics.GAL/Multithreading/CommandHelper.cs index 442a9045..95b33bc6 100644 --- a/Ryujinx.Graphics.GAL/Multithreading/CommandHelper.cs +++ b/Ryujinx.Graphics.GAL/Multithreading/CommandHelper.cs @@ -179,6 +179,8 @@ namespace Ryujinx.Graphics.GAL.Multithreading SetLineParametersCommand.Run(ref GetCommand(memory), threaded, renderer); _lookup[(int)CommandType.SetLogicOpState] = (Span memory, ThreadedRenderer threaded, IRenderer renderer) => SetLogicOpStateCommand.Run(ref GetCommand(memory), threaded, renderer); + _lookup[(int)CommandType.SetMultisampleState] = (Span memory, ThreadedRenderer threaded, IRenderer renderer) => + SetMultisampleStateCommand.Run(ref GetCommand(memory), threaded, renderer); _lookup[(int)CommandType.SetPatchParameters] = (Span memory, ThreadedRenderer threaded, IRenderer renderer) => SetPatchParametersCommand.Run(ref GetCommand(memory), threaded, renderer); _lookup[(int)CommandType.SetPointParameters] = (Span memory, ThreadedRenderer threaded, IRenderer renderer) => diff --git a/Ryujinx.Graphics.GAL/Multithreading/CommandType.cs b/Ryujinx.Graphics.GAL/Multithreading/CommandType.cs index 5c42abd1..8f0a0095 100644 --- a/Ryujinx.Graphics.GAL/Multithreading/CommandType.cs +++ b/Ryujinx.Graphics.GAL/Multithreading/CommandType.cs @@ -71,6 +71,7 @@ SetIndexBuffer, SetLineParameters, SetLogicOpState, + SetMultisampleState, SetPatchParameters, SetPointParameters, SetPolygonMode, diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/SetMultisampleStateCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/SetMultisampleStateCommand.cs new file mode 100644 index 00000000..f981c6ce --- /dev/null +++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/SetMultisampleStateCommand.cs @@ -0,0 +1,18 @@ +namespace Ryujinx.Graphics.GAL.Multithreading.Commands +{ + struct SetMultisampleStateCommand : IGALCommand + { + public CommandType CommandType => CommandType.SetMultisampleState; + private MultisampleDescriptor _multisample; + + public void Set(MultisampleDescriptor multisample) + { + _multisample = multisample; + } + + public static void Run(ref SetMultisampleStateCommand command, ThreadedRenderer threaded, IRenderer renderer) + { + renderer.Pipeline.SetMultisampleState(command._multisample); + } + } +} diff --git a/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs b/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs index 2a1f474a..aebf210d 100644 --- a/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs +++ b/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs @@ -184,6 +184,12 @@ namespace Ryujinx.Graphics.GAL.Multithreading _renderer.QueueCommand(); } + public void SetMultisampleState(MultisampleDescriptor multisample) + { + _renderer.New().Set(multisample); + _renderer.QueueCommand(); + } + public void SetPatchParameters(int vertices, ReadOnlySpan defaultOuterLevel, ReadOnlySpan defaultInnerLevel) { _renderer.New().Set(vertices, defaultOuterLevel, defaultInnerLevel); -- cgit v1.2.3