TextureOperation.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
  2. {
  3. class TextureOperation : Operation
  4. {
  5. private const int DefaultCbufSlot = -1;
  6. public SamplerType Type { get; private set; }
  7. public TextureFlags Flags { get; private set; }
  8. public int CbufSlot { get; private set; }
  9. public int Handle { get; private set; }
  10. public TextureFormat Format { get; set; }
  11. public TextureOperation(
  12. Instruction inst,
  13. SamplerType type,
  14. TextureFlags flags,
  15. int handle,
  16. int compIndex,
  17. Operand dest,
  18. params Operand[] sources) : base(inst, compIndex, dest, sources)
  19. {
  20. Type = type;
  21. Flags = flags;
  22. CbufSlot = DefaultCbufSlot;
  23. Handle = handle;
  24. }
  25. public void TurnIntoIndexed(int handle)
  26. {
  27. Type |= SamplerType.Indexed;
  28. Flags &= ~TextureFlags.Bindless;
  29. Handle = handle;
  30. }
  31. public void SetHandle(int handle, int cbufSlot = DefaultCbufSlot)
  32. {
  33. if ((Flags & TextureFlags.Bindless) != 0)
  34. {
  35. Flags &= ~TextureFlags.Bindless;
  36. RemoveSource(0);
  37. }
  38. CbufSlot = cbufSlot;
  39. Handle = handle;
  40. }
  41. }
  42. }