Implement vertex instancing (#381)
This commit is contained in:
@ -41,6 +41,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||
|
||||
public const string ExtraUniformBlockName = "Extra";
|
||||
public const string FlipUniformName = "flip";
|
||||
public const string InstanceUniformName = "instance";
|
||||
|
||||
public const string ProgramName = "program";
|
||||
public const string ProgramAName = ProgramName + "_a";
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user