|
Nameless Engine
|
#include <DirectXResource.h>
Classes | |
| struct | DescriptorsSameType |
Public Member Functions | |
| DirectXResource (const DirectXResource &)=delete | |
| DirectXResource & | operator= (const DirectXResource &)=delete |
| std::optional< Error > | bindDescriptor (DirectXDescriptorType descriptorType, const std::shared_ptr< ContinuousDirectXDescriptorRange > &pRange=nullptr, bool bBindDescriptorsToCubemapFaces=true) |
| std::optional< D3D12_CPU_DESCRIPTOR_HANDLE > | getBindedDescriptorCpuHandle (DirectXDescriptorType descriptorType) |
| std::optional< D3D12_CPU_DESCRIPTOR_HANDLE > | getBindedCubemapFaceDescriptorCpuHandle (DirectXDescriptorType descriptorType, size_t iCubemapFaceIndex) |
| std::optional< D3D12_GPU_DESCRIPTOR_HANDLE > | getBindedDescriptorGpuHandle (DirectXDescriptorType descriptorType) |
| ID3D12Resource * | getInternalResource () const |
| DirectXDescriptor * | getDescriptor (DirectXDescriptorType descriptorType) |
| TextureFilteringPreference | getTextureFilteringPreference () const |
Public Member Functions inherited from ne::GpuResource | |
| GpuResource (GpuResourceManager *pManager, const std::string &sResourceName, unsigned int iElementSizeInBytes, unsigned int iElementCount) | |
| GpuResource (GpuResource &)=delete | |
| GpuResource & | operator= (GpuResource &)=delete |
| std::string | getResourceName () const |
| unsigned int | getElementSizeInBytes () const |
| unsigned int | getElementCount () const |
| GpuResourceManager * | getResourceManager () const |
Private Member Functions | |
| DirectXResource (DirectXResourceManager *pResourceManager, const std::string &sResourceName, UINT iElementSizeInBytes, UINT iElementCount, TextureFilteringPreference filteringPreference=TextureFilteringPreference::FROM_RENDER_SETTINGS) | |
Static Private Member Functions | |
| static std::variant< std::unique_ptr< DirectXResource >, Error > | create (DirectXResourceManager *pResourceManager, const std::string &sResourceName, D3D12MA::Allocator *pMemoryAllocator, const D3D12MA::ALLOCATION_DESC &allocationDesc, const D3D12_RESOURCE_DESC &resourceDesc, const D3D12_RESOURCE_STATES &initialResourceState, std::optional< D3D12_CLEAR_VALUE > resourceClearValue, size_t iElementSizeInBytes=0, size_t iElementCount=0, TextureFilteringPreference filteringPreference=TextureFilteringPreference::FROM_RENDER_SETTINGS) |
| static std::variant< std::unique_ptr< DirectXResource >, Error > | createResourceFromSwapChainBuffer (DirectXResourceManager *pResourceManager, DirectXDescriptorHeap *pRtvHeap, const ComPtr< ID3D12Resource > &pSwapChainBuffer) |
Private Attributes | |
| std::pair< std::recursive_mutex, std::array< DescriptorsSameType, static_cast< size_t >(DirectXDescriptorType::END)> > | mtxHeapDescriptors |
| ComPtr< D3D12MA::Allocation > | pAllocatedResource |
| ComPtr< ID3D12Resource > | pSwapChainBuffer |
| ID3D12Resource * | pInternalResource = nullptr |
| const TextureFilteringPreference | textureFilteringPreference |
Friends | |
| class | DirectXDescriptorHeap |
| class | DirectXResourceManager |
D3D resource wrapper with automatic descriptor binding.
|
private |
Constructor. Creates an empty resource.
| pResourceManager | Owner resource manager. |
| sResourceName | Name of this resource. |
| iElementSizeInBytes | Resource size information. Size of one array element (if array), otherwise specify size of the whole resource. |
| iElementCount | Resource size information. Total number of elements in the array (if array), otherwise specify 1. |
| filteringPreference | If this resource is an image, optionally specify a filtering preference. |
| std::optional< Error > ne::DirectXResource::bindDescriptor | ( | DirectXDescriptorType | descriptorType, |
| const std::shared_ptr< ContinuousDirectXDescriptorRange > & | pRange = nullptr, |
||
| bool | bBindDescriptorsToCubemapFaces = true |
||
| ) |
Creates a new descriptor and binds it to this resource.
| descriptorType | Type of descriptor to bind. |
| pRange | Specify in order to allocate a descriptor from this range. The specified shared pointer will be copied and saved in the resource so that the range will not be destroyed while this resource references a descriptor from it. |
| bBindDescriptorsToCubemapFaces | If this resource is a cubemap, specify true to also bind descriptors that reference specific cubemap faces, specify false to only bind 1 descriptor that references the entire resource. |
|
staticprivate |
Creates a new resource (without binding a descriptor to it).
| pResourceManager | Owner resource manager. |
| sResourceName | Resource name, used for logging. |
| pMemoryAllocator | Allocator to create resource. |
| allocationDesc | Allocation description. |
| resourceDesc | Resource description. |
| initialResourceState | Initial state of this resource. |
| resourceClearValue | Optimized clear value. Pass empty if creating CBV/SRV/UAV resource. |
| iElementSizeInBytes | Optional parameter. Specify if this resource represents an array. Used for SRV creation. |
| iElementCount | Optional parameter. Specify if this resource represents an array. Used for SRV creation. |
| filteringPreference | If this resource is an image, optionally specify a filtering preference. |
|
staticprivate |
Creates a new resource instance by wrapping existing swap chain buffer, also binds RTV to the specified resource.
| pResourceManager | Owner resource manager. |
| pRtvHeap | Render target view heap manager. |
| pSwapChainBuffer | Swap chain buffer to wrap. |
| std::optional< D3D12_CPU_DESCRIPTOR_HANDLE > ne::DirectXResource::getBindedCubemapFaceDescriptorCpuHandle | ( | DirectXDescriptorType | descriptorType, |
| size_t | iCubemapFaceIndex | ||
| ) |
Returns descriptor handle to a cubemap face that was previously binded using bindDescriptor.
| descriptorType | Type of descriptor to get. |
| iCubemapFaceIndex | Index of the cubemap face to get descriptor handle to. |
| std::optional< D3D12_CPU_DESCRIPTOR_HANDLE > ne::DirectXResource::getBindedDescriptorCpuHandle | ( | DirectXDescriptorType | descriptorType | ) |
Returns descriptor handle to the descriptor that was previously binded using bindDescriptor.
| descriptorType | Type of descriptor to get. |
| std::optional< D3D12_GPU_DESCRIPTOR_HANDLE > ne::DirectXResource::getBindedDescriptorGpuHandle | ( | DirectXDescriptorType | descriptorType | ) |
Returns descriptor handle to the descriptor that was previously binded using bindDescriptor.
| descriptorType | Type of descriptor to get. |
| DirectXDescriptor * ne::DirectXResource::getDescriptor | ( | DirectXDescriptorType | descriptorType | ) |
Returns a raw (non-owning) pointer to a bound descriptor.
| descriptorType | Type of descriptor to query. |
nullptr if a descriptor of this type was not bound to this resource, otherwise valid pointer.
|
inline |
Returns internal resource.
|
inline |
Tells what texture filtering to use (if this resource is a texture).
|
private |
Array of descriptors used by this resource.
nullptr. nullptr descriptor means that it's not set (not used).
|
private |
Created resource (can be empty if pSwapChainBuffer is used).
|
private |
Pointer to pSwapChainBuffer or pAllocatedResource used for fast access to internal resource.
|
private |
Used when resource was created from swap chain buffer (can be empty if pAllocatedResource is used).
|
private |
Texture filtering to use (if this resource is a texture).