TextureOperation.cs
1 namespace Ryujinx.Graphics.Shader.IntermediateRepresentation 2 { 3 class TextureOperation : Operation 4 { 5 public const int DefaultCbufSlot = -1; 6 7 public SamplerType Type { get; set; } 8 public TextureFormat Format { get; set; } 9 public TextureFlags Flags { get; private set; } 10 11 public int Set { get; private set; } 12 public int Binding { get; private set; } 13 public int SamplerSet { get; private set; } 14 public int SamplerBinding { get; private set; } 15 16 public TextureOperation( 17 Instruction inst, 18 SamplerType type, 19 TextureFormat format, 20 TextureFlags flags, 21 int set, 22 int binding, 23 int compIndex, 24 Operand[] dests, 25 Operand[] sources) : base(inst, compIndex, dests, sources) 26 { 27 Type = type; 28 Format = format; 29 Flags = flags; 30 Set = set; 31 Binding = binding; 32 SamplerSet = -1; 33 SamplerBinding = -1; 34 } 35 36 public void TurnIntoArray(SetBindingPair setAndBinding) 37 { 38 Flags &= ~TextureFlags.Bindless; 39 Set = setAndBinding.SetIndex; 40 Binding = setAndBinding.Binding; 41 } 42 43 public void TurnIntoArray(SetBindingPair textureSetAndBinding, SetBindingPair samplerSetAndBinding) 44 { 45 TurnIntoArray(textureSetAndBinding); 46 47 SamplerSet = samplerSetAndBinding.SetIndex; 48 SamplerBinding = samplerSetAndBinding.Binding; 49 } 50 51 public void SetBinding(SetBindingPair setAndBinding) 52 { 53 if ((Flags & TextureFlags.Bindless) != 0) 54 { 55 Flags &= ~TextureFlags.Bindless; 56 57 RemoveSource(0); 58 } 59 60 Set = setAndBinding.SetIndex; 61 Binding = setAndBinding.Binding; 62 } 63 64 public void SetLodLevelFlag() 65 { 66 Flags |= TextureFlags.LodLevel; 67 } 68 } 69 }