Implement multiple rendertarget attachments and depth writting (#375)
* Add depth writting * Implement multiple attachments * Address feedback
This commit is contained in:
parent
9977acad0f
commit
624e813cd3
7 changed files with 201 additions and 29 deletions
|
@ -16,7 +16,6 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
public const int VertexIdAttr = 0x2fc;
|
||||
public const int FaceAttr = 0x3fc;
|
||||
|
||||
public const int MaxFrameBufferAttachments = 8;
|
||||
public const int MaxUboSize = 1024;
|
||||
|
||||
public const int GlPositionVec4Index = 7;
|
||||
|
@ -94,16 +93,33 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
m_Preds = new Dictionary<int, ShaderDeclInfo>();
|
||||
}
|
||||
|
||||
public GlslDecl(ShaderIrBlock[] Blocks, GalShaderType ShaderType) : this(ShaderType)
|
||||
public GlslDecl(ShaderIrBlock[] Blocks, GalShaderType ShaderType, ShaderHeader Header)
|
||||
: this(ShaderType)
|
||||
{
|
||||
StagePrefix = StagePrefixes[(int)ShaderType] + "_";
|
||||
|
||||
if (ShaderType == GalShaderType.Fragment)
|
||||
{
|
||||
//Note: Replace 1 with MaxFrameBufferAttachments when attachments start to work
|
||||
for (int Index = 0; Index < 1; Index++)
|
||||
int Index = 0;
|
||||
|
||||
for (int Attachment = 0; Attachment < 8; Attachment++)
|
||||
{
|
||||
m_Gprs.Add(Index * 4, new ShaderDeclInfo(FragmentOutputName + Index, Index * 4, false, 0, 4));
|
||||
for (int Component = 0; Component < 4; Component++)
|
||||
{
|
||||
if (Header.OmapTargets[Attachment].ComponentEnabled(Component))
|
||||
{
|
||||
m_Gprs.TryAdd(Index, new ShaderDeclInfo(GetGprName(Index), Index));
|
||||
|
||||
Index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Header.OmapDepth)
|
||||
{
|
||||
Index = Header.DepthRegister;
|
||||
|
||||
m_Gprs.TryAdd(Index, new ShaderDeclInfo(GetGprName(Index), Index));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,6 +169,11 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
return Combined;
|
||||
}
|
||||
|
||||
public static string GetGprName(int Index)
|
||||
{
|
||||
return GprName + Index;
|
||||
}
|
||||
|
||||
private static void Merge(
|
||||
Dictionary<int, ShaderDeclInfo> C,
|
||||
Dictionary<int, ShaderDeclInfo> A,
|
||||
|
@ -316,9 +337,9 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
|
||||
case ShaderIrOperGpr Gpr:
|
||||
{
|
||||
if (!Gpr.IsConst && !HasName(m_Gprs, Gpr.Index))
|
||||
if (!Gpr.IsConst)
|
||||
{
|
||||
string Name = GprName + Gpr.Index;
|
||||
string Name = GetGprName(Gpr.Index);
|
||||
|
||||
m_Gprs.TryAdd(Gpr.Index, new ShaderDeclInfo(Name, Gpr.Index));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue