LiteFX 0.5.1.2025
Computer Graphics Engine
Loading...
Searching...
No Matches
LiteFX::Rendering::IDescriptorSet Class Referenceabstract

The interface for a descriptor set. More...

#include <rendering_api.hpp>

Inherited by LiteFX::Rendering::DescriptorSet< IDirectX12Buffer, IDirectX12Image, IDirectX12Sampler, IDirectX12AccelerationStructure >, LiteFX::Rendering::DescriptorSet< IVulkanBuffer, IVulkanImage, IVulkanSampler, IVulkanAccelerationStructure >, and LiteFX::Rendering::DescriptorSet< TBuffer, TImage, TSampler, TAccelerationStructure >.

Public Member Functions

virtual ~IDescriptorSet () noexcept=default
 
virtual VirtualAllocator::Allocation globalHeapAllocation (DescriptorHeapType heapType) const noexcept=0
 Returns the allocation information for the descriptor set in the global descriptor heap indicated by heapType .
 
UInt32 bindToHeap (DescriptorType bindingType, UInt32 descriptor, const IBuffer &buffer, UInt32 bufferElement=0, UInt32 elements=0, Format texelFormat=Format::None) const
 Binds a resource directly to a descriptor heap and returns the index that can be used to access it.
 
UInt32 bindToHeap (DescriptorType bindingType, UInt32 descriptor, const IImage &image, UInt32 firstLevel=0, UInt32 levels=0, UInt32 firstLayer=0, UInt32 layers=0) const
 Binds a resource directly to a descriptor heap and returns the index that can be used to access it.
 
UInt32 bindToHeap (UInt32 descriptor, const ISampler &sampler) const
 Binds a sampler directly to a descriptor heap and returns the index that can be used to access it.
 
void update (UInt32 binding, const IBuffer &buffer, UInt32 bufferElement=0, UInt32 elements=0, UInt32 firstDescriptor=0, Format texelFormat=Format::None) const
 Updates one or more buffer descriptors within the current descriptor set.
 
void update (UInt32 binding, const IImage &texture, UInt32 descriptor=0, UInt32 firstLevel=0, UInt32 levels=0, UInt32 firstLayer=0, UInt32 layers=0) const
 Updates one or more texture descriptors within the current descriptor set.
 
void update (UInt32 binding, const ISampler &sampler, UInt32 descriptor=0) const
 Updates one or more sampler descriptors within the current descriptor set.
 
void update (UInt32 binding, const IAccelerationStructure &accelerationStructure, UInt32 descriptor=0) const
 Updates an acceleration structure within the current descriptor set.
 

Protected Member Functions

 IDescriptorSet () noexcept=default
 
 IDescriptorSet (const IDescriptorSet &)=default
 
 IDescriptorSet (IDescriptorSet &&) noexcept=default
 
IDescriptorSetoperator= (const IDescriptorSet &)=default
 
IDescriptorSetoperator= (IDescriptorSet &&) noexcept=default
 

Detailed Description

The interface for a descriptor set.

Constructor & Destructor Documentation

◆ IDescriptorSet() [1/3]

LiteFX::Rendering::IDescriptorSet::IDescriptorSet ( )
protecteddefaultnoexcept

◆ IDescriptorSet() [2/3]

LiteFX::Rendering::IDescriptorSet::IDescriptorSet ( const IDescriptorSet & )
protecteddefault

◆ IDescriptorSet() [3/3]

LiteFX::Rendering::IDescriptorSet::IDescriptorSet ( IDescriptorSet && )
protecteddefaultnoexcept

◆ ~IDescriptorSet()

virtual LiteFX::Rendering::IDescriptorSet::~IDescriptorSet ( )
virtualdefaultnoexcept

Member Function Documentation

◆ bindToHeap() [1/3]

UInt32 LiteFX::Rendering::IDescriptorSet::bindToHeap ( DescriptorType bindingType,
UInt32 descriptor,
const IBuffer & buffer,
UInt32 bufferElement = 0,
UInt32 elements = 0,
Format texelFormat = Format::None ) const
inline

Binds a resource directly to a descriptor heap and returns the index that can be used to access it.

This method is used with the GraphicsDeviceFeature::DynamicDescriptors feature and allows to bind a descriptor to the underlying descriptor heap directly by providing the corresponding resource type (indicated by bindingType ) at bind time. The method directly returns the global heap index of the resource, that can be used by the shader to access it using the ResourceDescriptorHeap syntax (in HLSL).

If the descriptor set does not contain a descriptor of type DescriptorType::ResourceDescriptorHeap, this method will throw an exception.

Parameters
bindingTypeThe type of the descriptor used to bind buffer to the heap.
descriptorThe index of the descriptor in the heap to bind buffer to.
bufferThe buffer to bind.
bufferElementThe index of an element inside buffer that should be bound.
elementsThe number of elements from the buffer to bind to the descriptor set. A value of 0 binds all available elements, starting at bufferElement .
texelFormatThe format used to read a texel buffer. Required if binding binds a texel buffer and ignored otherwise.
Returns
The global heap index that can be used to access the resource from the shader.
Exceptions
RuntimeExceptionThrown, if the descriptor set does not contain a descriptor that provides direct heap access to the underlying descriptor heap indicated by bindingType .

◆ bindToHeap() [2/3]

UInt32 LiteFX::Rendering::IDescriptorSet::bindToHeap ( DescriptorType bindingType,
UInt32 descriptor,
const IImage & image,
UInt32 firstLevel = 0,
UInt32 levels = 0,
UInt32 firstLayer = 0,
UInt32 layers = 0 ) const
inline

Binds a resource directly to a descriptor heap and returns the index that can be used to access it.

This method is used with the GraphicsDeviceFeature::DynamicDescriptors feature and allows to bind a descriptor to the underlying descriptor heap directly by providing the corresponding resource type (indicated by bindingType ) at bind time. The method directly returns the global heap index of the resource, that can be used by the shader to access it using the ResourceDescriptorHeap syntax (in HLSL).

If the descriptor set does not contain a descriptor of type DescriptorType::ResourceDescriptorHeap, this method will throw an exception.

Parameters
bindingTypeThe type of the descriptor used to bind image to the heap.
descriptorThe index of the descriptor in the heap to bind image to.
imageThe image to bind.
firstLevelThe index of the first mip-map level to bind.
levelsThe number of mip-map levels to bind. A value of 0 binds all available levels, starting at firstLevel .
firstLayerThe index of the first layer to bind.
layersThe number of layers to bind. A value of 0 binds all available layers, starting at firstLayer .
Returns
The global heap index that can be used to access the resource from the shader.
Exceptions
RuntimeExceptionThrown, if the descriptor set does not contain a descriptor that provides direct heap access to the underlying descriptor heap indicated by bindingType .

◆ bindToHeap() [3/3]

UInt32 LiteFX::Rendering::IDescriptorSet::bindToHeap ( UInt32 descriptor,
const ISampler & sampler ) const
inline

Binds a sampler directly to a descriptor heap and returns the index that can be used to access it.

This method is used with the GraphicsDeviceFeature::DynamicDescriptors feature and allows to bind a descriptor to the underlying descriptor heap directly. The method returns the global heap index of the sampler, that can be used by the shader to access it using the SamplerDescriptorHeap syntax (in HLSL).

If the descriptor set does not contain a descriptor of type DescriptorType::SamplerDescriptorHeap, this method will throw an exception.

Parameters
descriptorThe index of the descriptor in the heap to bind sampler to.
samplerThe sampler to bind.
Returns
The global heap index that can be used to access the sampler from the shader.
Exceptions
RuntimeExceptionThrown, if the descriptor set does not contain a descriptor that provides direct heap access to the underlying descriptor heap indicated by bindingType .

◆ globalHeapAllocation()

virtual VirtualAllocator::Allocation LiteFX::Rendering::IDescriptorSet::globalHeapAllocation ( DescriptorHeapType heapType) const
pure virtualnoexcept

Returns the allocation information for the descriptor set in the global descriptor heap indicated by heapType .

Parameters
heapTypeThe type of the descriptor heap for which to obtain the heap allocation.
Returns
The allocation for the descriptor set in the global descriptor heap.

Implemented in LiteFX::Rendering::Backends::DirectX12DescriptorSet, and LiteFX::Rendering::Backends::VulkanDescriptorSet.

◆ operator=() [1/2]

IDescriptorSet & LiteFX::Rendering::IDescriptorSet::operator= ( const IDescriptorSet & )
protecteddefault

◆ operator=() [2/2]

IDescriptorSet & LiteFX::Rendering::IDescriptorSet::operator= ( IDescriptorSet && )
protecteddefaultnoexcept

◆ update() [1/4]

void LiteFX::Rendering::IDescriptorSet::update ( UInt32 binding,
const IAccelerationStructure & accelerationStructure,
UInt32 descriptor = 0 ) const
inline

Updates an acceleration structure within the current descriptor set.

Parameters
bindingThe acceleration structure binding point.
accelerationStructureThe acceleration structure to write to the descriptor set.
descriptorThe index of the descriptor in the descriptor array to bind the acceleration structure to.

◆ update() [2/4]

void LiteFX::Rendering::IDescriptorSet::update ( UInt32 binding,
const IBuffer & buffer,
UInt32 bufferElement = 0,
UInt32 elements = 0,
UInt32 firstDescriptor = 0,
Format texelFormat = Format::None ) const
inline

Updates one or more buffer descriptors within the current descriptor set.

Parameters
bindingThe buffer binding point.
bufferThe buffer to write to the descriptor set.
bufferElementThe index of the first element in the buffer to bind to the descriptor set.
elementsThe number of elements from the buffer to bind to the descriptor set. A value of 0 binds all available elements, starting at bufferElement .
firstDescriptorThe index of the first descriptor in the descriptor array to update.
texelFormatThe format used to read a texel buffer. Required if binding binds a texel buffer and ignored otherwise.

◆ update() [3/4]

void LiteFX::Rendering::IDescriptorSet::update ( UInt32 binding,
const IImage & texture,
UInt32 descriptor = 0,
UInt32 firstLevel = 0,
UInt32 levels = 0,
UInt32 firstLayer = 0,
UInt32 layers = 0 ) const
inline

Updates one or more texture descriptors within the current descriptor set.

The exact representation of the level and layer parameters depends on the dimension of the provided texture, as well as the type of the descriptor identified by the binding parameter.

If the texture itself is not an array (i.e. the number of layers equals 1), the parameters firstLayer and layers are ignored.

The descriptor type dictates, how mip-maps can be provided. If the descriptor type identifies a writable texture, the firstLevel parameter specifies the mip-map level to write to (or read from). Multiple levels are not allowed in this case, so the levels parameter is ignored. Instead, you have to bind them to separate descriptors. Furthermore, the firstLayer and layers parameter can be used to specify the number of depth or W-slices of a writable 3D texture or the side(s) of a cube map.

Parameters
bindingThe texture binding point.
textureThe texture to write to the descriptor set.
descriptorThe index of the descriptor in the descriptor array to bind the texture to.
firstLevelThe index of the first mip-map level to bind.
levelsThe number of mip-map levels to bind. A value of 0 binds all available levels, starting at firstLevel .
firstLayerThe index of the first layer to bind.
layersThe number of layers to bind. A value of 0 binds all available layers, starting at firstLayer .

◆ update() [4/4]

void LiteFX::Rendering::IDescriptorSet::update ( UInt32 binding,
const ISampler & sampler,
UInt32 descriptor = 0 ) const
inline

Updates one or more sampler descriptors within the current descriptor set.

Parameters
bindingThe sampler binding point.
samplerThe sampler to write to the descriptor set.
descriptorThe index of the descriptor in the descriptor array to bind the sampler to.