Browse Source

OpenGL: Mask out all color outputs with no fragment shader (#6341)

* OpenGL: Mask out all color outputs with no fragment shader

This appears to match Vulkan's behaviour, which is needed for stencil shadows in Penny's Big Breakaway. It's far from the only issue, you can try the Full Bindless PR if you want to see it in a more intact state.

* Remove unused member
riperiperi 2 years ago
parent
commit
57d8afd0c9

+ 1 - 1
src/Ryujinx.Graphics.OpenGL/Pipeline.cs

@@ -1117,7 +1117,7 @@ namespace Ryujinx.Graphics.OpenGL
                 prg.Bind();
                 prg.Bind();
             }
             }
 
 
-            if (prg.HasFragmentShader && _fragmentOutputMap != (uint)prg.FragmentOutputMap)
+            if (_fragmentOutputMap != (uint)prg.FragmentOutputMap)
             {
             {
                 _fragmentOutputMap = (uint)prg.FragmentOutputMap;
                 _fragmentOutputMap = (uint)prg.FragmentOutputMap;
 
 

+ 4 - 5
src/Ryujinx.Graphics.OpenGL/Program.cs

@@ -30,7 +30,6 @@ namespace Ryujinx.Graphics.OpenGL
         private ProgramLinkStatus _status = ProgramLinkStatus.Incomplete;
         private ProgramLinkStatus _status = ProgramLinkStatus.Incomplete;
         private int[] _shaderHandles;
         private int[] _shaderHandles;
 
 
-        public bool HasFragmentShader;
         public int FragmentOutputMap { get; }
         public int FragmentOutputMap { get; }
 
 
         public Program(ShaderSource[] shaders, int fragmentOutputMap)
         public Program(ShaderSource[] shaders, int fragmentOutputMap)
@@ -40,6 +39,7 @@ namespace Ryujinx.Graphics.OpenGL
             GL.ProgramParameter(Handle, ProgramParameterName.ProgramBinaryRetrievableHint, 1);
             GL.ProgramParameter(Handle, ProgramParameterName.ProgramBinaryRetrievableHint, 1);
 
 
             _shaderHandles = new int[shaders.Length];
             _shaderHandles = new int[shaders.Length];
+            bool hasFragmentShader = false;
 
 
             for (int index = 0; index < shaders.Length; index++)
             for (int index = 0; index < shaders.Length; index++)
             {
             {
@@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.OpenGL
 
 
                 if (shader.Stage == ShaderStage.Fragment)
                 if (shader.Stage == ShaderStage.Fragment)
                 {
                 {
-                    HasFragmentShader = true;
+                    hasFragmentShader = true;
                 }
                 }
 
 
                 int shaderHandle = GL.CreateShader(shader.Stage.Convert());
                 int shaderHandle = GL.CreateShader(shader.Stage.Convert());
@@ -71,7 +71,7 @@ namespace Ryujinx.Graphics.OpenGL
 
 
             GL.LinkProgram(Handle);
             GL.LinkProgram(Handle);
 
 
-            FragmentOutputMap = fragmentOutputMap;
+            FragmentOutputMap = hasFragmentShader ? fragmentOutputMap : 0;
         }
         }
 
 
         public Program(ReadOnlySpan<byte> code, bool hasFragmentShader, int fragmentOutputMap)
         public Program(ReadOnlySpan<byte> code, bool hasFragmentShader, int fragmentOutputMap)
@@ -91,8 +91,7 @@ namespace Ryujinx.Graphics.OpenGL
                 }
                 }
             }
             }
 
 
-            HasFragmentShader = hasFragmentShader;
-            FragmentOutputMap = fragmentOutputMap;
+            FragmentOutputMap = hasFragmentShader ? fragmentOutputMap : 0;
         }
         }
 
 
         public void Bind()
         public void Bind()