Use multiple dest operands for shader call instructions (#1975)

* Use multiple dest operands for shader call instructions

* Passing opNode is no longer needed
This commit is contained in:
gdkchan 2021-01-31 21:13:38 -03:00 committed by GitHub
parent f93089a64f
commit 053dcfdb05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 45 deletions

View file

@ -51,9 +51,9 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
{
context.LeaveBlock(block, operation);
}
else if (operation.Inst != Instruction.CallOutArgument)
else
{
AddOperation(context, opNode);
AddOperation(context, operation);
}
}
}
@ -68,32 +68,13 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
return context.Info;
}
private static void AddOperation(StructuredProgramContext context, LinkedListNode<INode> opNode)
private static void AddOperation(StructuredProgramContext context, Operation operation)
{
Operation operation = (Operation)opNode.Value;
Instruction inst = operation.Inst;
bool isCall = inst == Instruction.Call;
int sourcesCount = operation.SourcesCount;
int outDestsCount = operation.DestsCount != 0 ? operation.DestsCount - 1 : 0;
List<Operand> callOutOperands = new List<Operand>();
if (isCall)
{
LinkedListNode<INode> scan = opNode.Next;
while (scan != null && scan.Value is Operation nextOp && nextOp.Inst == Instruction.CallOutArgument)
{
callOutOperands.Add(nextOp.Dest);
scan = scan.Next;
}
sourcesCount += callOutOperands.Count;
}
IAstNode[] sources = new IAstNode[sourcesCount + outDestsCount];
for (int index = 0; index < operation.SourcesCount; index++)
@ -101,16 +82,6 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
sources[index] = context.GetOperandUse(operation.GetSource(index));
}
if (isCall)
{
for (int index = 0; index < callOutOperands.Count; index++)
{
sources[operation.SourcesCount + index] = context.GetOperandDef(callOutOperands[index]);
}
callOutOperands.Clear();
}
for (int index = 0; index < outDestsCount; index++)
{
AstOperand oper = context.GetOperandDef(operation.GetDest(1 + index));