aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL/Framebuffer.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-10-12 21:50:41 -0300
committerGitHub <noreply@github.com>2020-10-12 21:50:41 -0300
commit6a51b628f910deb6356974c2eb6fb2dba1dfdb34 (patch)
tree9ed7b7825f41aaf3e88f0e6c69a080e5b0038bc0 /Ryujinx.Graphics.OpenGL/Framebuffer.cs
parente4777717cdf70c61365494cdb91568172fa5bfe8 (diff)
Fix error when dual source blend is used (#1610)
* Fix error when dual source blend is used * Ensure framebuffer
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Framebuffer.cs')
-rw-r--r--Ryujinx.Graphics.OpenGL/Framebuffer.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Framebuffer.cs b/Ryujinx.Graphics.OpenGL/Framebuffer.cs
index aececbe8..015b0ec0 100644
--- a/Ryujinx.Graphics.OpenGL/Framebuffer.cs
+++ b/Ryujinx.Graphics.OpenGL/Framebuffer.cs
@@ -13,6 +13,9 @@ namespace Ryujinx.Graphics.OpenGL
private readonly TextureView[] _colors;
+ private int _colorsCount;
+ private bool _dualSourceBlend;
+
public Framebuffer()
{
Handle = GL.GenFramebuffer();
@@ -97,8 +100,36 @@ namespace Ryujinx.Graphics.OpenGL
}
}
+ public void SetDualSourceBlend(bool enable)
+ {
+ bool oldEnable = _dualSourceBlend;
+
+ _dualSourceBlend = enable;
+
+ // When dual source blend is used,
+ // we can only have one draw buffer.
+ if (enable)
+ {
+ GL.DrawBuffer(DrawBufferMode.ColorAttachment0);
+ }
+ else if (oldEnable)
+ {
+ SetDrawBuffersImpl(_colorsCount);
+ }
+ }
+
public void SetDrawBuffers(int colorsCount)
{
+ if (_colorsCount != colorsCount && !_dualSourceBlend)
+ {
+ SetDrawBuffersImpl(colorsCount);
+ }
+
+ _colorsCount = colorsCount;
+ }
+
+ private void SetDrawBuffersImpl(int colorsCount)
+ {
DrawBuffersEnum[] drawBuffers = new DrawBuffersEnum[colorsCount];
for (int index = 0; index < colorsCount; index++)