mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-29 04:21:20 -08:00
9dfe81770a
* Change AggregateType to include vector type counts * Replace VariableType uses with AggregateType and delete VariableType * Support new local vector types on SPIR-V and GLSL * Start using vector outputs for texture operations * Use vectors on more texture operations * Use vector output for ImageLoad operations * Replace all uses of single destination texture constructors with multi destination ones * Update textureGatherOffsets replacement to split vector operations * Shader cache version bump Co-authored-by: Ac_K <Acoustik666@gmail.com>
74 lines
2.0 KiB
C#
74 lines
2.0 KiB
C#
using Ryujinx.Graphics.Shader.IntermediateRepresentation;
|
|
using Ryujinx.Graphics.Shader.Translation;
|
|
|
|
namespace Ryujinx.Graphics.Shader.StructuredIr
|
|
{
|
|
static class AstHelper
|
|
{
|
|
public static void AddUse(IAstNode node, IAstNode parent)
|
|
{
|
|
if (node is AstOperand operand && operand.Type == OperandType.LocalVariable)
|
|
{
|
|
operand.Uses.Add(parent);
|
|
}
|
|
}
|
|
|
|
public static void AddDef(IAstNode node, IAstNode parent)
|
|
{
|
|
if (node is AstOperand operand && operand.Type == OperandType.LocalVariable)
|
|
{
|
|
operand.Defs.Add(parent);
|
|
}
|
|
}
|
|
|
|
public static void RemoveUse(IAstNode node, IAstNode parent)
|
|
{
|
|
if (node is AstOperand operand && operand.Type == OperandType.LocalVariable)
|
|
{
|
|
operand.Uses.Remove(parent);
|
|
}
|
|
}
|
|
|
|
public static void RemoveDef(IAstNode node, IAstNode parent)
|
|
{
|
|
if (node is AstOperand operand && operand.Type == OperandType.LocalVariable)
|
|
{
|
|
operand.Defs.Remove(parent);
|
|
}
|
|
}
|
|
|
|
public static AstAssignment Assign(IAstNode destination, IAstNode source)
|
|
{
|
|
return new AstAssignment(destination, source);
|
|
}
|
|
|
|
public static AstOperand Const(int value)
|
|
{
|
|
return new AstOperand(OperandType.Constant, value);
|
|
}
|
|
|
|
public static AstOperand Local(AggregateType type)
|
|
{
|
|
AstOperand local = new AstOperand(OperandType.LocalVariable);
|
|
|
|
local.VarType = type;
|
|
|
|
return local;
|
|
}
|
|
|
|
public static IAstNode InverseCond(IAstNode cond)
|
|
{
|
|
return new AstOperation(Instruction.LogicalNot, cond);
|
|
}
|
|
|
|
public static IAstNode Next(IAstNode node)
|
|
{
|
|
return node.LLNode.Next?.Value;
|
|
}
|
|
|
|
public static IAstNode Previous(IAstNode node)
|
|
{
|
|
return node.LLNode.Previous?.Value;
|
|
}
|
|
}
|
|
} |