using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.Shader; namespace Ryujinx.Graphics.Gpu.Image { /// /// Texture binding information. /// This is used for textures that needs to be accessed from shaders. /// struct TextureBindingInfo { /// /// Shader sampler target type. /// public Target Target { get; } /// /// For images, indicates the format specified on the shader. /// public Format Format { get; } /// /// Shader texture host binding point. /// public int Binding { get; } /// /// Shader texture handle. /// This is an index into the texture constant buffer. /// public int Handle { get; } /// /// Indicates if the texture is a bindless texture. /// /// /// For those textures, Handle is ignored. /// public bool IsBindless { get; } /// /// Constant buffer slot with the bindless texture handle, for bindless texture. /// public int CbufSlot { get; } /// /// Constant buffer offset of the bindless texture handle, for bindless texture. /// public int CbufOffset { get; } /// /// Flags from the texture descriptor that indicate how the texture is used. /// public TextureUsageFlags Flags { get; } /// /// Constructs the texture binding information structure. /// /// The shader sampler target type /// Format of the image as declared on the shader /// The shader texture binding point /// The shader texture handle (read index into the texture constant buffer) /// The texture's usage flags, indicating how it is used in the shader public TextureBindingInfo(Target target, Format format, int binding, int handle, TextureUsageFlags flags) { Target = target; Format = format; Binding = binding; Handle = handle; IsBindless = false; CbufSlot = 0; CbufOffset = 0; Flags = flags; } /// /// Constructs the texture binding information structure. /// /// The shader sampler target type /// The shader texture binding point /// The shader texture handle (read index into the texture constant buffer) /// The texture's usage flags, indicating how it is used in the shader public TextureBindingInfo(Target target, int binding, int handle, TextureUsageFlags flags) : this(target, (Format)0, binding, handle, flags) { } /// /// Constructs the bindless texture binding information structure. /// /// The shader sampler target type /// The shader texture binding point /// Constant buffer slot where the bindless texture handle is located /// Constant buffer offset of the bindless texture handle /// The texture's usage flags, indicating how it is used in the shader public TextureBindingInfo(Target target, int binding, int cbufSlot, int cbufOffset, TextureUsageFlags flags) { Target = target; Format = 0; Binding = binding; Handle = 0; IsBindless = true; CbufSlot = cbufSlot; CbufOffset = cbufOffset; Flags = flags; } } }