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.
///
readonly 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; }
///
/// For array of textures, this indicates the length of the array. A value of one indicates it is not an array.
///
public int ArrayLength { get; }
///
/// Constant buffer slot with the texture handle.
///
public int CbufSlot { get; }
///
/// Index of the texture handle on the constant buffer at slot .
///
public int Handle { get; }
///
/// Flags from the texture descriptor that indicate how the texture is used.
///
public TextureUsageFlags Flags { get; }
///
/// Indicates that the binding is for a sampler.
///
public bool IsSamplerOnly { 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
/// For array of textures, this indicates the length of the array. A value of one indicates it is not an array
/// Constant buffer slot where the texture handle is located
/// 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 arrayLength, int cbufSlot, int handle, TextureUsageFlags flags)
{
Target = target;
Format = format;
Binding = binding;
ArrayLength = arrayLength;
CbufSlot = cbufSlot;
Handle = handle;
Flags = flags;
}
///
/// Constructs the texture binding information structure.
///
/// The shader sampler target type
/// The shader texture binding point
/// For array of textures, this indicates the length of the array. A value of one indicates it is not an array
/// Constant buffer slot where the texture handle is located
/// The shader texture handle (read index into the texture constant buffer)
/// The texture's usage flags, indicating how it is used in the shader
/// Indicates that the binding is for a sampler
public TextureBindingInfo(
Target target,
int binding,
int arrayLength,
int cbufSlot,
int handle,
TextureUsageFlags flags,
bool isSamplerOnly) : this(target, 0, binding, arrayLength, cbufSlot, handle, flags)
{
IsSamplerOnly = isSamplerOnly;
}
}
}