diff options
Diffstat (limited to 'Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramContext.cs')
-rw-r--r-- | Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramContext.cs | 67 |
1 files changed, 8 insertions, 59 deletions
diff --git a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramContext.cs b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramContext.cs index ce57a578..68bbdeb1 100644 --- a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramContext.cs +++ b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramContext.cs @@ -37,43 +37,26 @@ namespace Ryujinx.Graphics.Shader.StructuredIr Config = config; - if (config.Stage == ShaderStage.TessellationControl) - { - // Required to index outputs. - Info.Inputs.Add(AttributeConsts.InvocationId); - } - else if (config.GpPassthrough) + if (config.GpPassthrough) { int passthroughAttributes = config.PassthroughAttributes; while (passthroughAttributes != 0) { int index = BitOperations.TrailingZeroCount(passthroughAttributes); - int attrBase = AttributeConsts.UserAttributeBase + index * 16; - Info.Inputs.Add(attrBase); - Info.Inputs.Add(attrBase + 4); - Info.Inputs.Add(attrBase + 8); - Info.Inputs.Add(attrBase + 12); + Info.IoDefinitions.Add(new IoDefinition(StorageKind.Input, IoVariable.UserDefined, index)); passthroughAttributes &= ~(1 << index); } - Info.Inputs.Add(AttributeConsts.PositionX); - Info.Inputs.Add(AttributeConsts.PositionY); - Info.Inputs.Add(AttributeConsts.PositionZ); - Info.Inputs.Add(AttributeConsts.PositionW); - Info.Inputs.Add(AttributeConsts.PointSize); - - for (int i = 0; i < 8; i++) - { - Info.Inputs.Add(AttributeConsts.ClipDistance0 + i * 4); - } + Info.IoDefinitions.Add(new IoDefinition(StorageKind.Input, IoVariable.Position)); + Info.IoDefinitions.Add(new IoDefinition(StorageKind.Input, IoVariable.PointSize)); + Info.IoDefinitions.Add(new IoDefinition(StorageKind.Input, IoVariable.ClipDistance)); } else if (config.Stage == ShaderStage.Fragment) { // Potentially used for texture coordinate scaling. - Info.Inputs.Add(AttributeConsts.PositionX); - Info.Inputs.Add(AttributeConsts.PositionY); + Info.IoDefinitions.Add(new IoDefinition(StorageKind.Input, IoVariable.FragmentCoord)); } } @@ -281,7 +264,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr } else { - cond = GetOperandUse(branchOp.GetSource(0)); + cond = GetOperand(branchOp.GetSource(0)); Instruction invInst = type == AstBlockType.If ? Instruction.BranchIfTrue @@ -315,41 +298,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr return newTemp; } - public AstOperand GetOperandDef(Operand operand) - { - if (operand.Type == OperandType.Attribute) - { - Info.Outputs.Add(operand.Value & AttributeConsts.Mask); - } - else if (operand.Type == OperandType.AttributePerPatch) - { - Info.OutputsPerPatch.Add(operand.Value & AttributeConsts.Mask); - } - - return GetOperand(operand); - } - - public AstOperand GetOperandUse(Operand operand) - { - // If this flag is set, we're reading from an output attribute instead. - if (operand.Type.IsAttribute() && (operand.Value & AttributeConsts.LoadOutputMask) != 0) - { - return GetOperandDef(operand); - } - - if (operand.Type == OperandType.Attribute) - { - Info.Inputs.Add(operand.Value); - } - else if (operand.Type == OperandType.AttributePerPatch) - { - Info.InputsPerPatch.Add(operand.Value); - } - - return GetOperand(operand); - } - - private AstOperand GetOperand(Operand operand) + public AstOperand GetOperand(Operand operand) { if (operand == null) { |