TextureOperation.cs 1.8 KB

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