Support constant attributes (with a value of zero) (#1066)

* Support constant attributes (with a value of zero)

* Remove extra line
This commit is contained in:
gdkchan 2020-03-29 23:11:24 -03:00 committed by GitHub
parent 8f21db810d
commit 9948a7be53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 4 deletions

View file

@ -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);
}