aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2022-08-08 14:39:22 -0300
committerGitHub <noreply@github.com>2022-08-08 17:39:22 +0000
commit66e7fdb8710ff24bfb80c9c638ce2e6fa9563068 (patch)
tree7be487e2abc0e8069944b40965e5d2cd5d0cea05
parent2bb9b33da1f872dc7e52b92c9f282e3d971d2cdf (diff)
OpenGL: Fix clears of unbound color targets (#3564)1.1.209
-rw-r--r--Ryujinx.Graphics.OpenGL/Framebuffer.cs2
-rw-r--r--Ryujinx.Graphics.OpenGL/Pipeline.cs4
2 files changed, 5 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Framebuffer.cs b/Ryujinx.Graphics.OpenGL/Framebuffer.cs
index d132e9c4..b180b857 100644
--- a/Ryujinx.Graphics.OpenGL/Framebuffer.cs
+++ b/Ryujinx.Graphics.OpenGL/Framebuffer.cs
@@ -147,7 +147,7 @@ namespace Ryujinx.Graphics.OpenGL
public int GetColorLayerCount(int index)
{
- return _colors[index].Info.GetDepthOrLayers();
+ return _colors[index]?.Info.GetDepthOrLayers() ?? 0;
}
public int GetDepthStencilLayerCount()
diff --git a/Ryujinx.Graphics.OpenGL/Pipeline.cs b/Ryujinx.Graphics.OpenGL/Pipeline.cs
index 58d165d9..fc28c86e 100644
--- a/Ryujinx.Graphics.OpenGL/Pipeline.cs
+++ b/Ryujinx.Graphics.OpenGL/Pipeline.cs
@@ -112,6 +112,8 @@ namespace Ryujinx.Graphics.OpenGL
public void ClearRenderTargetColor(int index, int layer, int layerCount, uint componentMask, ColorF color)
{
+ EnsureFramebuffer();
+
GL.ColorMask(
index,
(componentMask & 1) != 0,
@@ -142,6 +144,8 @@ namespace Ryujinx.Graphics.OpenGL
public void ClearRenderTargetDepthStencil(int layer, int layerCount, float depthValue, bool depthMask, int stencilValue, int stencilMask)
{
+ EnsureFramebuffer();
+
bool stencilMaskChanged =
stencilMask != 0 &&
stencilMask != _stencilFrontMask;