Nameless Engine
|
#include <DirectXDescriptorHeap.h>
Classes | |
struct | InternalData |
Public Member Functions | |
ContinuousDirectXDescriptorRange (const ContinuousDirectXDescriptorRange &other)=delete | |
ContinuousDirectXDescriptorRange & | operator= (const ContinuousDirectXDescriptorRange &other)=delete |
ContinuousDirectXDescriptorRange (ContinuousDirectXDescriptorRange &&other) noexcept=delete | |
ContinuousDirectXDescriptorRange & | operator= (ContinuousDirectXDescriptorRange &&other) noexcept=delete |
std::variant< unsigned int, Error > | getResourceDescriptorOffsetFromRangeStart (DirectXResource *pResource, DirectXDescriptorType descriptorType) |
size_t | getRangeSize () |
size_t | getRangeCapacity () |
INT | getRangeStartInHeap () |
D3D12_GPU_DESCRIPTOR_HANDLE | getGpuDescriptorHandleToRangeStart () const |
Static Public Member Functions | |
static constexpr INT | getRangeGrowSize () |
Private Member Functions | |
ContinuousDirectXDescriptorRange (DirectXDescriptorHeap *pHeap, const std::function< void()> &onRangeIndicesChanged, const std::string &sRangeName) | |
std::optional< Error > | markDescriptorAsUnused (DirectXDescriptor *pDescriptor) |
std::variant< std::optional< INT >, Error > | tryReserveFreeHeapIndexToCreateDescriptor () |
Private Attributes | |
std::pair< std::recursive_mutex, InternalData > | mtxInternalData |
const std::function< void()> | onRangeIndicesChanged |
const std::string | sRangeName |
DirectXDescriptorHeap *const | pHeap = nullptr |
Static Private Attributes | |
static constexpr INT | iRangeGrowSize = 50 |
Friends | |
class | DirectXDescriptorHeap |
Works as a mini descriptor heap that operates on descriptors in a continuous range (can be used for bindless bindings of descriptor arrays).
|
private |
Creates a new range (with capacity iRangeGrowSize but no descriptor is used) allocated in a descriptor heap.
pHeap | Heap that allocated the range. |
onRangeIndicesChanged | Callback that will be called after the range was moved in the heap due to things like heap expand/shrink. |
sRangeName | Name of this range (used for logging). |
D3D12_GPU_DESCRIPTOR_HANDLE ne::ContinuousDirectXDescriptorRange::getGpuDescriptorHandleToRangeStart | ( | ) | const |
Returns a GPU descriptor handle to the current range start.
size_t ne::ContinuousDirectXDescriptorRange::getRangeCapacity | ( | ) |
Returns the total number of descriptors that this range can currently store.
|
inlinestaticconstexpr |
Returns grow/shrink size for all continuous descriptor ranges.
size_t ne::ContinuousDirectXDescriptorRange::getRangeSize | ( | ) |
Returns the number of active (currently in-use) descriptors that were allocated from this range.
INT ne::ContinuousDirectXDescriptorRange::getRangeStartInHeap | ( | ) |
Returns index of the first descriptor of this range in the heap.
std::variant< unsigned int, Error > ne::ContinuousDirectXDescriptorRange::getResourceDescriptorOffsetFromRangeStart | ( | DirectXResource * | pResource, |
DirectXDescriptorType | descriptorType | ||
) |
Calculates an offset of the descriptor (of the specified resource) from the start of this range.
pResource | Resource with already binded descriptor within this range. |
descriptorType | Type of the descriptor to look for. |
|
private |
Removes the specified descriptor from the range and marks descriptor's index as unused.
pDescriptor | Descriptor to remove. |
|
private |
Looks if there is a free index in the range that can be used to create a new descriptor or if there is no space (expansion needed).
|
staticconstexprprivate |
Grow/shrink size for all ranges. Constant for all ranges because it causes the heap to be re-created and we want to avoid small ranges and big ranges (due to how heap expands/shrinks) which also depends on the heap grow size.
|
private |
Internal data.
|
private |
Called after the range was moved in the heap due to things like heap expand/shrink.
|
private |
Heap that allocated the range.
|
private |
Name of this range (used for logging).