Add multiple color outputs for fragment shaders
This commit is contained in:
parent
6e1a6c5b2b
commit
0fe651cc2f
2 changed files with 8 additions and 4 deletions
|
@ -16,6 +16,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
public const int VertexIdAttr = 0x2fc;
|
public const int VertexIdAttr = 0x2fc;
|
||||||
public const int FaceAttr = 0x3fc;
|
public const int FaceAttr = 0x3fc;
|
||||||
|
|
||||||
|
public const int MaxFrameBufferAttachments = 8;
|
||||||
public const int MaxUboSize = 1024;
|
public const int MaxUboSize = 1024;
|
||||||
|
|
||||||
public const int GlPositionVec4Index = 7;
|
public const int GlPositionVec4Index = 7;
|
||||||
|
@ -99,7 +100,10 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
if (ShaderType == GalShaderType.Fragment)
|
if (ShaderType == GalShaderType.Fragment)
|
||||||
{
|
{
|
||||||
m_Gprs.Add(0, new ShaderDeclInfo(FragmentOutputName, 0, false, 0, 4));
|
for (int Index = 0; Index < MaxFrameBufferAttachments; Index++)
|
||||||
|
{
|
||||||
|
m_Gprs.Add(Index * 4, new ShaderDeclInfo(FragmentOutputName + Index, Index * 4, false, 0, 4));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ShaderIrBlock Block in Blocks)
|
foreach (ShaderIrBlock Block in Blocks)
|
||||||
|
|
|
@ -352,9 +352,9 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
{
|
{
|
||||||
Name = CustomType + " " + DeclInfo.Name + Suffix + ";";
|
Name = CustomType + " " + DeclInfo.Name + Suffix + ";";
|
||||||
}
|
}
|
||||||
else if (DeclInfo.Name == GlslDecl.FragmentOutputName)
|
else if (DeclInfo.Name.Contains(GlslDecl.FragmentOutputName))
|
||||||
{
|
{
|
||||||
Name = "layout (location = 0) out vec4 " + DeclInfo.Name + Suffix + ";" + Environment.NewLine;
|
Name = "layout (location = " + DeclInfo.Index / 4 + ") out vec4 " + DeclInfo.Name + Suffix + ";" + Environment.NewLine;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -876,7 +876,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
private string GetNameWithSwizzle(IReadOnlyDictionary<int, ShaderDeclInfo> Dict, int Index)
|
private string GetNameWithSwizzle(IReadOnlyDictionary<int, ShaderDeclInfo> Dict, int Index)
|
||||||
{
|
{
|
||||||
int VecIndex = Index >> 2;
|
int VecIndex = Index & ~3;
|
||||||
|
|
||||||
if (Dict.TryGetValue(VecIndex, out ShaderDeclInfo DeclInfo))
|
if (Dict.TryGetValue(VecIndex, out ShaderDeclInfo DeclInfo))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue