TextureBindingInfo.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using Ryujinx.Graphics.GAL;
  2. namespace Ryujinx.Graphics.Gpu.Image
  3. {
  4. /// <summary>
  5. /// Texture binding information.
  6. /// This is used for textures that needs to be accessed from shaders.
  7. /// </summary>
  8. struct TextureBindingInfo
  9. {
  10. /// <summary>
  11. /// Shader sampler target type.
  12. /// </summary>
  13. public Target Target { get; }
  14. /// <summary>
  15. /// Shader texture handle.
  16. /// This is a index into the texture constant buffer.
  17. /// </summary>
  18. public int Handle { get; }
  19. /// <summary>
  20. /// Indicates if the texture is a bindless texture.
  21. /// For those textures, Handle is ignored.
  22. /// </summary>
  23. public bool IsBindless { get; }
  24. /// <summary>
  25. /// Constant buffer slot with the bindless texture handle, for bindless texture.
  26. /// </summary>
  27. public int CbufSlot { get; }
  28. /// <summary>
  29. /// Constant buffer offset of the bindless texture handle, for bindless texture.
  30. /// </summary>
  31. public int CbufOffset { get; }
  32. /// <summary>
  33. /// Constructs the texture binding information structure.
  34. /// </summary>
  35. /// <param name="target">The shader sampler target type</param>
  36. /// <param name="handle">The shader texture handle (read index into the texture constant buffer)</param>
  37. public TextureBindingInfo(Target target, int handle)
  38. {
  39. Target = target;
  40. Handle = handle;
  41. IsBindless = false;
  42. CbufSlot = 0;
  43. CbufOffset = 0;
  44. }
  45. /// <summary>
  46. /// Constructs the bindless texture binding information structure.
  47. /// </summary>
  48. /// <param name="target">The shader sampler target type</param>
  49. /// <param name="cbufSlot">Constant buffer slot where the bindless texture handle is located</param>
  50. /// <param name="cbufOffset">Constant buffer offset of the bindless texture handle</param>
  51. public TextureBindingInfo(Target target, int cbufSlot, int cbufOffset)
  52. {
  53. Target = target;
  54. Handle = 0;
  55. IsBindless = true;
  56. CbufSlot = cbufSlot;
  57. CbufOffset = cbufOffset;
  58. }
  59. }
  60. }