TextureOperation.cs 1.4 KB

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