TextureBindingInfo.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using Ryujinx.Graphics.GAL;
  2. using Ryujinx.Graphics.Shader;
  3. namespace Ryujinx.Graphics.Gpu.Image
  4. {
  5. /// <summary>
  6. /// Texture binding information.
  7. /// This is used for textures that needs to be accessed from shaders.
  8. /// </summary>
  9. readonly struct TextureBindingInfo
  10. {
  11. /// <summary>
  12. /// Shader sampler target type.
  13. /// </summary>
  14. public Target Target { get; }
  15. /// <summary>
  16. /// For images, indicates the format specified on the shader.
  17. /// </summary>
  18. public Format Format { get; }
  19. /// <summary>
  20. /// Shader texture host binding point.
  21. /// </summary>
  22. public int Binding { get; }
  23. /// <summary>
  24. /// Constant buffer slot with the texture handle.
  25. /// </summary>
  26. public int CbufSlot { get; }
  27. /// <summary>
  28. /// Index of the texture handle on the constant buffer at slot <see cref="CbufSlot"/>.
  29. /// </summary>
  30. public int Handle { get; }
  31. /// <summary>
  32. /// Flags from the texture descriptor that indicate how the texture is used.
  33. /// </summary>
  34. public TextureUsageFlags Flags { get; }
  35. /// <summary>
  36. /// Constructs the texture binding information structure.
  37. /// </summary>
  38. /// <param name="target">The shader sampler target type</param>
  39. /// <param name="format">Format of the image as declared on the shader</param>
  40. /// <param name="binding">The shader texture binding point</param>
  41. /// <param name="cbufSlot">Constant buffer slot where the texture handle is located</param>
  42. /// <param name="handle">The shader texture handle (read index into the texture constant buffer)</param>
  43. /// <param name="flags">The texture's usage flags, indicating how it is used in the shader</param>
  44. public TextureBindingInfo(Target target, Format format, int binding, int cbufSlot, int handle, TextureUsageFlags flags)
  45. {
  46. Target = target;
  47. Format = format;
  48. Binding = binding;
  49. CbufSlot = cbufSlot;
  50. Handle = handle;
  51. Flags = flags;
  52. }
  53. /// <summary>
  54. /// Constructs the texture binding information structure.
  55. /// </summary>
  56. /// <param name="target">The shader sampler target type</param>
  57. /// <param name="binding">The shader texture binding point</param>
  58. /// <param name="cbufSlot">Constant buffer slot where the texture handle is located</param>
  59. /// <param name="handle">The shader texture handle (read index into the texture constant buffer)</param>
  60. /// <param name="flags">The texture's usage flags, indicating how it is used in the shader</param>
  61. public TextureBindingInfo(Target target, int binding, int cbufSlot, int handle, TextureUsageFlags flags) : this(target, (Format)0, binding, cbufSlot, handle, flags)
  62. {
  63. }
  64. }
  65. }