step back
This commit is contained in:
parent
f99990b3de
commit
9ffbcc4b8c
1 changed files with 41 additions and 42 deletions
|
@ -23,6 +23,8 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
private const int MaxVertexInput = 3;
|
private const int MaxVertexInput = 3;
|
||||||
|
|
||||||
|
private static string[] ElemTypes = new string[] { "float", "vec2", "vec3", "vec4" };
|
||||||
|
|
||||||
private GlslDecl Decl;
|
private GlslDecl Decl;
|
||||||
|
|
||||||
private ShaderHeader Header, HeaderB;
|
private ShaderHeader Header, HeaderB;
|
||||||
|
@ -264,7 +266,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
{
|
{
|
||||||
if (DeclInfo.Index >= 0)
|
if (DeclInfo.Index >= 0)
|
||||||
{
|
{
|
||||||
SB.AppendLine(IdentationStr + "layout (location = " + DeclInfo.Index + ") " + "vec4 " + DeclInfo.Name + "; ");
|
SB.AppendLine(IdentationStr + "layout (location = " + DeclInfo.Index + ") " + GetDecl(DeclInfo) + "; ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,7 +297,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
{
|
{
|
||||||
if (DeclInfo.Index >= 0)
|
if (DeclInfo.Index >= 0)
|
||||||
{
|
{
|
||||||
SB.AppendLine("layout (location = " + DeclInfo.Index + ") " + InOut + " vec4 " + DeclInfo.Name + ";");
|
SB.AppendLine("layout (location = " + DeclInfo.Index + ") " + InOut + " " + GetDecl(DeclInfo) + ";");
|
||||||
|
|
||||||
Count++;
|
Count++;
|
||||||
}
|
}
|
||||||
|
@ -329,7 +331,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
}
|
}
|
||||||
else if (DeclInfo.Name == GlslDecl.FragmentOutputName)
|
else if (DeclInfo.Name == GlslDecl.FragmentOutputName)
|
||||||
{
|
{
|
||||||
Name = "layout (location = 0) out " + "vec4 " + DeclInfo.Name + Suffix + ";" + Environment.NewLine;
|
Name = "layout (location = 0) out " + GetDecl(DeclInfo) + Suffix + ";" + Environment.NewLine;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -352,14 +354,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
private string GetDecl(ShaderDeclInfo DeclInfo)
|
private string GetDecl(ShaderDeclInfo DeclInfo)
|
||||||
{
|
{
|
||||||
if (DeclInfo.Size == 4)
|
return ElemTypes[DeclInfo.Size - 1] + " " + DeclInfo.Name;
|
||||||
{
|
|
||||||
return "vec4 " + DeclInfo.Name;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return "float " + DeclInfo.Name;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PrintMain()
|
private void PrintMain()
|
||||||
|
@ -375,11 +370,13 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
ShaderDeclInfo DeclInfo = KV.Value;
|
ShaderDeclInfo DeclInfo = KV.Value;
|
||||||
|
|
||||||
|
string Swizzle = ".xyzw".Substring(0, DeclInfo.Size + 1);
|
||||||
|
|
||||||
if (Decl.ShaderType == GalShaderType.Geometry)
|
if (Decl.ShaderType == GalShaderType.Geometry)
|
||||||
{
|
{
|
||||||
for (int Vertex = 0; Vertex < MaxVertexInput; Vertex++)
|
for (int Vertex = 0; Vertex < MaxVertexInput; Vertex++)
|
||||||
{
|
{
|
||||||
string Dst = Attr.Name + "[" + Vertex + "]";
|
string Dst = Attr.Name + "[" + Vertex + "]" + Swizzle;
|
||||||
|
|
||||||
string Src = "block_in[" + Vertex + "]." + DeclInfo.Name;
|
string Src = "block_in[" + Vertex + "]." + DeclInfo.Name;
|
||||||
|
|
||||||
|
@ -388,7 +385,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SB.AppendLine(IdentationStr + Attr.Name + " = " + DeclInfo.Name + ";");
|
SB.AppendLine(IdentationStr + Attr.Name + Swizzle + " = " + DeclInfo.Name + ";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,6 +418,8 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
ShaderDeclInfo DeclInfo = KV.Value;
|
ShaderDeclInfo DeclInfo = KV.Value;
|
||||||
|
|
||||||
|
string Swizzle = ".xyzw".Substring(0, DeclInfo.Size + 1);
|
||||||
|
|
||||||
string Name = Attr.Name;
|
string Name = Attr.Name;
|
||||||
|
|
||||||
if (Decl.ShaderType == GalShaderType.Geometry)
|
if (Decl.ShaderType == GalShaderType.Geometry)
|
||||||
|
@ -428,7 +427,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
Name += "[0]";
|
Name += "[0]";
|
||||||
}
|
}
|
||||||
|
|
||||||
SB.AppendLine(Identation + DeclInfo.Name + " = " + Name + ";");
|
SB.AppendLine(Identation + DeclInfo.Name + " = " + Name + Swizzle + ";");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Decl.ShaderType == GalShaderType.Vertex)
|
if (Decl.ShaderType == GalShaderType.Vertex)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue