TextureBindingInfo.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 an 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. /// </summary>
  22. /// <remarks>
  23. /// For those textures, Handle is ignored.
  24. /// </remarks>
  25. public bool IsBindless { get; }
  26. /// <summary>
  27. /// Constant buffer slot with the bindless texture handle, for bindless texture.
  28. /// </summary>
  29. public int CbufSlot { get; }
  30. /// <summary>
  31. /// Constant buffer offset of the bindless texture handle, for bindless texture.
  32. /// </summary>
  33. public int CbufOffset { get; }
  34. /// <summary>
  35. /// Constructs the texture binding information structure.
  36. /// </summary>
  37. /// <param name="target">The shader sampler target type</param>
  38. /// <param name="handle">The shader texture handle (read index into the texture constant buffer)</param>
  39. public TextureBindingInfo(Target target, int handle)
  40. {
  41. Target = target;
  42. Handle = handle;
  43. IsBindless = false;
  44. CbufSlot = 0;
  45. CbufOffset = 0;
  46. }
  47. /// <summary>
  48. /// Constructs the bindless texture binding information structure.
  49. /// </summary>
  50. /// <param name="target">The shader sampler target type</param>
  51. /// <param name="cbufSlot">Constant buffer slot where the bindless texture handle is located</param>
  52. /// <param name="cbufOffset">Constant buffer offset of the bindless texture handle</param>
  53. public TextureBindingInfo(Target target, int cbufSlot, int cbufOffset)
  54. {
  55. Target = target;
  56. Handle = 0;
  57. IsBindless = true;
  58. CbufSlot = cbufSlot;
  59. CbufOffset = cbufOffset;
  60. }
  61. }
  62. }