diff options
author | gdkchan <gab.dark.100@gmail.com> | 2023-02-19 22:37:37 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-19 22:37:37 -0300 |
commit | 7aa430f1a51fd793971992b4454540975222b848 (patch) | |
tree | e6a33e3df7aa5155b7c597b2ff226178f57434d1 /Ryujinx.Graphics.OpenGL/Pipeline.cs | |
parent | 6bf460e1041b969a453dc40ee6fb83164739bf9c (diff) |
Add support for advanced blend (part 1/2) (#2801)1.1.626
* Add blend microcode registers
* Add advanced blend support using host extension
* Remove debug message
* Use pre-generated table for blend functions
* XML docs
* Rename AdvancedBlendMode to AdvancedBlendOp for consistency
* Remove redundant code
* Fix some advanced blend related issues on Vulkan
* Formatting
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Pipeline.cs')
-rw-r--r-- | Ryujinx.Graphics.OpenGL/Pipeline.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Pipeline.cs b/Ryujinx.Graphics.OpenGL/Pipeline.cs index 8bcaf4c7..970feea0 100644 --- a/Ryujinx.Graphics.OpenGL/Pipeline.cs +++ b/Ryujinx.Graphics.OpenGL/Pipeline.cs @@ -59,6 +59,7 @@ namespace Ryujinx.Graphics.OpenGL private uint _fragmentOutputMap; private uint _componentMasks; private uint _currentComponentMasks; + private bool _advancedBlendEnable; private uint _scissorEnables; @@ -784,8 +785,26 @@ namespace Ryujinx.Graphics.OpenGL GL.Enable(EnableCap.AlphaTest); } + public void SetBlendState(AdvancedBlendDescriptor blend) + { + if (HwCapabilities.SupportsBlendEquationAdvanced) + { + GL.BlendEquation((BlendEquationMode)blend.Op.Convert()); + GL.NV.BlendParameter(NvBlendEquationAdvanced.BlendOverlapNv, (int)blend.Overlap.Convert()); + GL.NV.BlendParameter(NvBlendEquationAdvanced.BlendPremultipliedSrcNv, blend.SrcPreMultiplied ? 1 : 0); + GL.Enable(EnableCap.Blend); + _advancedBlendEnable = true; + } + } + public void SetBlendState(int index, BlendDescriptor blend) { + if (_advancedBlendEnable) + { + GL.Disable(EnableCap.Blend); + _advancedBlendEnable = false; + } + if (!blend.Enable) { GL.Disable(IndexedEnableCap.Blend, index); |