From 9948a7be53a9846b9de493653aa76819ff1b9bd3 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 29 Mar 2020 23:11:24 -0300 Subject: Support constant attributes (with a value of zero) (#1066) * Support constant attributes (with a value of zero) * Remove extra line --- Ryujinx.Graphics.OpenGL/VertexArray.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Ryujinx.Graphics.OpenGL/VertexArray.cs') diff --git a/Ryujinx.Graphics.OpenGL/VertexArray.cs b/Ryujinx.Graphics.OpenGL/VertexArray.cs index 721a90f0..43d200a4 100644 --- a/Ryujinx.Graphics.OpenGL/VertexArray.cs +++ b/Ryujinx.Graphics.OpenGL/VertexArray.cs @@ -58,8 +58,17 @@ namespace Ryujinx.Graphics.OpenGL { FormatInfo fmtInfo = FormatTable.GetFormatInfo(attrib.Format); - GL.EnableVertexAttribArray(attribIndex); - + if (attrib.IsZero) + { + // Disabling the attribute causes the shader to read a constant value. + // The value is configurable, but by default is a vector of (0, 0, 0, 1). + GL.DisableVertexAttribArray(attribIndex); + } + else + { + GL.EnableVertexAttribArray(attribIndex); + } + int offset = attrib.Offset; int size = fmtInfo.Components; @@ -117,7 +126,7 @@ namespace Ryujinx.Graphics.OpenGL continue; } - if (_needsAttribsUpdate) + if (_needsAttribsUpdate && !attrib.IsZero) { GL.EnableVertexAttribArray(attribIndex); } -- cgit v1.2.3