TextureOperation.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. }
  56. }