Make sure attributes used on subsequent shader stages are initialized (#2538)

This commit is contained in:
gdkchan 2021-08-11 17:27:00 -03:00 committed by GitHub
parent 10d649e6d3
commit ed754af8d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 347 additions and 262 deletions

View file

@ -277,21 +277,11 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
public AstOperand GetOperandDef(Operand operand)
{
if (TryGetUserAttributeIndex(operand, out int attrIndex))
{
Info.OAttributes.Add(attrIndex);
}
return GetOperand(operand);
}
public AstOperand GetOperandUse(Operand operand)
{
if (TryGetUserAttributeIndex(operand, out int attrIndex))
{
Info.IAttributes.Add(attrIndex);
}
return GetOperand(operand);
}
@ -318,30 +308,5 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
return astOperand;
}
private static bool TryGetUserAttributeIndex(Operand operand, out int attrIndex)
{
if (operand.Type == OperandType.Attribute)
{
if (operand.Value >= AttributeConsts.UserAttributeBase &&
operand.Value < AttributeConsts.UserAttributeEnd)
{
attrIndex = (operand.Value - AttributeConsts.UserAttributeBase) >> 4;
return true;
}
else if (operand.Value >= AttributeConsts.FragmentOutputColorBase &&
operand.Value < AttributeConsts.FragmentOutputColorEnd)
{
attrIndex = (operand.Value - AttributeConsts.FragmentOutputColorBase) >> 4;
return true;
}
}
attrIndex = 0;
return false;
}
}
}