Просмотр исходного кода

OpenGL: Fix clears of unbound color targets (#3564)

gdkchan 3 лет назад
Родитель
Сommit
66e7fdb871
2 измененных файлов с 5 добавлено и 1 удалено
  1. 1 1
      Ryujinx.Graphics.OpenGL/Framebuffer.cs
  2. 4 0
      Ryujinx.Graphics.OpenGL/Pipeline.cs

+ 1 - 1
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()

+ 4 - 0
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;