Nameless Engine
Loading...
Searching...
No Matches
ne::DirectXDescriptor Class Reference

#include <DirectXDescriptor.h>

Public Member Functions

 ~DirectXDescriptor ()
 
 DirectXDescriptor (const DirectXDescriptor &other)=delete
 
DirectXDescriptoroperator= (const DirectXDescriptor &other)=delete
 
 DirectXDescriptor (DirectXDescriptor &&other) noexcept=delete
 
DirectXDescriptoroperator= (DirectXDescriptor &&other) noexcept=delete
 
int getOffsetInDescriptorsOnCurrentFrame () const
 
std::variant< unsigned int, ErrorgetOffsetFromRangeStartOnCurrentFrame ()
 
DirectXDescriptorHeapgetDescriptorHeap () const
 
std::shared_ptr< ContinuousDirectXDescriptorRangegetDescriptorRange () const
 
DirectXResourcegetOwnerResource () const
 

Protected Member Functions

 DirectXDescriptor (DirectXDescriptorHeap *pHeap, DirectXDescriptorType descriptorType, DirectXResource *pResource, int iDescriptorOffsetInDescriptors, std::optional< size_t > referencedCubemapFaceIndex, const std::shared_ptr< ContinuousDirectXDescriptorRange > &pRange=nullptr)
 

Private Attributes

int iDescriptorOffsetInDescriptors
 
DirectXResourcepResource = nullptr
 
DirectXDescriptorHeap *const pHeap = nullptr
 
std::shared_ptr< ContinuousDirectXDescriptorRange > const pRange = nullptr
 
const std::optional< size_t > referencedCubemapFaceIndex
 
const DirectXDescriptorType descriptorType
 

Friends

class DirectXDescriptorHeap
 

Detailed Description

Represents a descriptor (to a resource) that is stored in a descriptor heap. Automatically marked as unused in destructor.

Constructor & Destructor Documentation

◆ ~DirectXDescriptor()

ne::DirectXDescriptor::~DirectXDescriptor ( )

Notifies the heap.

◆ DirectXDescriptor()

ne::DirectXDescriptor::DirectXDescriptor ( DirectXDescriptorHeap pHeap,
DirectXDescriptorType  descriptorType,
DirectXResource pResource,
int  iDescriptorOffsetInDescriptors,
std::optional< size_t >  referencedCubemapFaceIndex,
const std::shared_ptr< ContinuousDirectXDescriptorRange > &  pRange = nullptr 
)
protected

Constructor.

Parameters
pHeapHeap of this descriptor.
descriptorTypeType of this descriptor.
pResourceOwner resource of this descriptor.
iDescriptorOffsetInDescriptorsOffset of this descriptor from the heap start (offset is specified in descriptors, not an actual index).
referencedCubemapFaceIndexSpecify empty if this descriptor does not reference a cubemap, otherwise index of cubemap's face that it references.
pRangeRange that this descriptor was allocated from. nullptr if allocated not from a range.

Member Function Documentation

◆ getDescriptorHeap()

DirectXDescriptorHeap * ne::DirectXDescriptor::getDescriptorHeap ( ) const
inline

Returns heap that this descriptor uses.

Returns
Descriptor heap.

◆ getDescriptorRange()

std::shared_ptr< ContinuousDirectXDescriptorRange > ne::DirectXDescriptor::getDescriptorRange ( ) const
inline

Returns descriptor range that this descriptor was allocated from.

Returns
nullptr if this descriptor was not allocated from a range, otherwise a valid pointer.

◆ getOffsetFromRangeStartOnCurrentFrame()

std::variant< unsigned int, Error > ne::DirectXDescriptor::getOffsetFromRangeStartOnCurrentFrame ( )

Calculates an offset of the descriptor from the start of the range (see getDescriptorRange) that this descriptor was allocated from.

Warning
Returned value is only valid until the descriptor heap has not resized, so it's only safe to call this function when you know that the descriptor heap will not resize. This function is generally used during rendering when we know that the descriptor heap will not resize.
You shouldn't store returned offset for more that 1 frame as it might change after a frame is submitted (because the descriptor heap may resize).
Returns
Error if this descriptor was not allocated from a range or something went wrong, otherwise offset (in descriptors) of the descriptor from range start.

◆ getOffsetInDescriptorsOnCurrentFrame()

int ne::DirectXDescriptor::getOffsetInDescriptorsOnCurrentFrame ( ) const
inline

Returns offset of this descriptor from the heap start (offset is specified in descriptors, not an actual index).

Warning
Returned value is only valid until the descriptor heap has not resized, so it's only safe to call this function when you know that the descriptor heap will not resize. This function is generally used during rendering when we know that the descriptor heap will not resize.
You shouldn't store returned offset for more that 1 frame as it might change after a frame is submitted (because the descriptor heap may resize).
Returns
Descriptor offset.

◆ getOwnerResource()

DirectXResource * ne::DirectXDescriptor::getOwnerResource ( ) const

Returns resource that owns this descriptor.

Returns
nullptr if this descriptor is being destroyed, otherwise owner resource.

Member Data Documentation

◆ descriptorType

const DirectXDescriptorType ne::DirectXDescriptor::descriptorType
private

Type of this descriptor.

◆ iDescriptorOffsetInDescriptors

int ne::DirectXDescriptor::iDescriptorOffsetInDescriptors
private

Offset of this descriptor from the heap start (offset is specified in descriptors, not an actual index).

◆ pHeap

DirectXDescriptorHeap* const ne::DirectXDescriptor::pHeap = nullptr
private

Do not delete. Heap of this descriptor.

◆ pRange

std::shared_ptr<ContinuousDirectXDescriptorRange> const ne::DirectXDescriptor::pRange = nullptr
private

Range that allocated this descriptor (nullptr if allocated not from a range).

◆ pResource

DirectXResource* ne::DirectXDescriptor::pResource = nullptr
private

Do not delete. Always valid unless we are in the destructor. Owner resource of this descriptor.

◆ referencedCubemapFaceIndex

const std::optional<size_t> ne::DirectXDescriptor::referencedCubemapFaceIndex
private

Not empty if this descriptor references a cubemap's face.


The documentation for this class was generated from the following files: