diff options
Diffstat (limited to 'Ryujinx.Graphics.Shader/IntermediateRepresentation')
6 files changed, 110 insertions, 29 deletions
diff --git a/Ryujinx.Graphics.Shader/IntermediateRepresentation/Instruction.cs b/Ryujinx.Graphics.Shader/IntermediateRepresentation/Instruction.cs index aa9776bc..d7c4a961 100644 --- a/Ryujinx.Graphics.Shader/IntermediateRepresentation/Instruction.cs +++ b/Ryujinx.Graphics.Shader/IntermediateRepresentation/Instruction.cs @@ -78,7 +78,7 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation ImageStore, ImageAtomic, IsNan, - LoadAttribute, + Load, LoadConstant, LoadGlobal, LoadLocal, @@ -116,7 +116,7 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation ShuffleXor, Sine, SquareRoot, - StoreAttribute, + Store, StoreGlobal, StoreGlobal16, StoreGlobal8, @@ -144,13 +144,6 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation FP32 = 1 << 16, FP64 = 1 << 17, - MrShift = 18, - - MrGlobal = 0 << MrShift, - MrShared = 1 << MrShift, - MrStorage = 2 << MrShift, - MrMask = 3 << MrShift, - Mask = 0xffff } diff --git a/Ryujinx.Graphics.Shader/IntermediateRepresentation/IoVariable.cs b/Ryujinx.Graphics.Shader/IntermediateRepresentation/IoVariable.cs new file mode 100644 index 00000000..a2163d14 --- /dev/null +++ b/Ryujinx.Graphics.Shader/IntermediateRepresentation/IoVariable.cs @@ -0,0 +1,51 @@ +namespace Ryujinx.Graphics.Shader.IntermediateRepresentation +{ + enum IoVariable + { + Invalid, + + BackColorDiffuse, + BackColorSpecular, + BaseInstance, + BaseVertex, + ClipDistance, + CtaId, + DrawIndex, + FogCoord, + FragmentCoord, + FragmentOutputColor, + FragmentOutputDepth, + FragmentOutputIsBgra, // TODO: Remove and use constant buffer access. + FrontColorDiffuse, + FrontColorSpecular, + FrontFacing, + InstanceId, + InstanceIndex, + InvocationId, + Layer, + PatchVertices, + PointCoord, + PointSize, + Position, + PrimitiveId, + SubgroupEqMask, + SubgroupGeMask, + SubgroupGtMask, + SubgroupLaneId, + SubgroupLeMask, + SubgroupLtMask, + SupportBlockViewInverse, // TODO: Remove and use constant buffer access. + SupportBlockRenderScale, // TODO: Remove and use constant buffer access. + TessellationCoord, + TessellationLevelInner, + TessellationLevelOuter, + TextureCoord, + ThreadId, + ThreadKill, + UserDefined, + VertexId, + VertexIndex, + ViewportIndex, + ViewportMask + } +}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Shader/IntermediateRepresentation/OperandHelper.cs b/Ryujinx.Graphics.Shader/IntermediateRepresentation/OperandHelper.cs index 7fed861e..37c349e8 100644 --- a/Ryujinx.Graphics.Shader/IntermediateRepresentation/OperandHelper.cs +++ b/Ryujinx.Graphics.Shader/IntermediateRepresentation/OperandHelper.cs @@ -10,16 +10,6 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation return new Operand(OperandType.Argument, value); } - public static Operand Attribute(int value) - { - return new Operand(OperandType.Attribute, value); - } - - public static Operand AttributePerPatch(int value) - { - return new Operand(OperandType.AttributePerPatch, value); - } - public static Operand Cbuf(int slot, int offset) { return new Operand(slot, offset); diff --git a/Ryujinx.Graphics.Shader/IntermediateRepresentation/OperandType.cs b/Ryujinx.Graphics.Shader/IntermediateRepresentation/OperandType.cs index 7566a03f..4d2da734 100644 --- a/Ryujinx.Graphics.Shader/IntermediateRepresentation/OperandType.cs +++ b/Ryujinx.Graphics.Shader/IntermediateRepresentation/OperandType.cs @@ -3,8 +3,6 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation enum OperandType { Argument, - Attribute, - AttributePerPatch, Constant, ConstantBuffer, Label, @@ -12,12 +10,4 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation Register, Undefined } - - static class OperandTypeExtensions - { - public static bool IsAttribute(this OperandType type) - { - return type == OperandType.Attribute || type == OperandType.AttributePerPatch; - } - } }
\ No newline at end of file diff --git a/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs b/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs index 18e203a7..99179f15 100644 --- a/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs +++ b/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs @@ -6,6 +6,7 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation class Operation : INode { public Instruction Inst { get; private set; } + public StorageKind StorageKind { get; } private Operand[] _dests; @@ -99,6 +100,23 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation } } + public Operation(Instruction inst, StorageKind storageKind, Operand dest, params Operand[] sources) : this(sources) + { + Inst = inst; + StorageKind = storageKind; + + if (dest != null) + { + dest.AsgOp = this; + + _dests = new[] { dest }; + } + else + { + _dests = Array.Empty<Operand>(); + } + } + public Operation(Instruction inst, int index, Operand dest, params Operand[] sources) : this(inst, dest, sources) { Index = index; diff --git a/Ryujinx.Graphics.Shader/IntermediateRepresentation/StorageKind.cs b/Ryujinx.Graphics.Shader/IntermediateRepresentation/StorageKind.cs new file mode 100644 index 00000000..59357443 --- /dev/null +++ b/Ryujinx.Graphics.Shader/IntermediateRepresentation/StorageKind.cs @@ -0,0 +1,39 @@ +namespace Ryujinx.Graphics.Shader.IntermediateRepresentation +{ + enum StorageKind + { + None, + Input, + InputPerPatch, + Output, + OutputPerPatch, + ConstantBuffer, + StorageBuffer, + LocalMemory, + SharedMemory, + GlobalMemory + } + + static class StorageKindExtensions + { + public static bool IsInputOrOutput(this StorageKind storageKind) + { + return storageKind == StorageKind.Input || + storageKind == StorageKind.InputPerPatch || + storageKind == StorageKind.Output || + storageKind == StorageKind.OutputPerPatch; + } + + public static bool IsOutput(this StorageKind storageKind) + { + return storageKind == StorageKind.Output || + storageKind == StorageKind.OutputPerPatch; + } + + public static bool IsPerPatch(this StorageKind storageKind) + { + return storageKind == StorageKind.InputPerPatch || + storageKind == StorageKind.OutputPerPatch; + } + } +}
\ No newline at end of file |