Implement vertex instancing (#381)

This commit is contained in:
ReinUsesLisp 2018-08-25 01:16:58 -03:00 committed by gdkchan
parent da7e702751
commit a42ab2e40c
7 changed files with 82 additions and 20 deletions

View file

@ -241,10 +241,15 @@ namespace Ryujinx.Graphics.Gal.Shader
{
if (Decl.ShaderType == GalShaderType.Vertex)
{
SB.AppendLine("layout (std140) uniform " + GlslDecl.ExtraUniformBlockName + "{");
//Memory layout here is [flip_x, flip_y, instance, unused]
//It's using 4 bytes, not 8
SB.AppendLine("layout (std140) uniform " + GlslDecl.ExtraUniformBlockName + " {");
SB.AppendLine(IdentationStr + "vec2 " + GlslDecl.FlipUniformName + ";");
SB.AppendLine(IdentationStr + "int " + GlslDecl.InstanceUniformName + ";");
SB.AppendLine("};");
}
@ -816,7 +821,7 @@ namespace Ryujinx.Graphics.Gal.Shader
switch (Abuf.Offs)
{
case GlslDecl.VertexIdAttr: return "gl_VertexID";
case GlslDecl.InstanceIdAttr: return "gl_InstanceID";
case GlslDecl.InstanceIdAttr: return GlslDecl.InstanceUniformName;
}
}
else if (Decl.ShaderType == GalShaderType.TessEvaluation)