diff --git a/Ryujinx.Graphics.OpenGL/Framebuffer.cs b/Ryujinx.Graphics.OpenGL/Framebuffer.cs index d132e9c49..b180b8578 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 58d165d93..fc28c86e8 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;