Nameless Engine
|
#include <HlslShaderTextureResource.h>
Public Member Functions | |
void | setGraphicsRootDescriptorTableOfOnlyPipeline (const ComPtr< ID3D12GraphicsCommandList > &pCommandList) const |
void | setGraphicsRootDescriptorTableOfPipeline (const ComPtr< ID3D12GraphicsCommandList > &pCommandList, DirectXPso *pUsedPipeline) const |
virtual std::optional< Error > | useNewTexture (std::unique_ptr< TextureHandle > pTextureToUse) override |
virtual std::optional< Error > | changeUsedPipelines (const std::unordered_set< Pipeline * > &pipelinesToUse) override |
virtual std::optional< Error > | useNewTexture (std::unique_ptr< TextureHandle > pTextureToUse)=0 |
Public Member Functions inherited from ne::ShaderResourceBase | |
virtual std::optional< Error > | changeUsedPipelines (const std::unordered_set< Pipeline * > &pipelinesToUse)=0 |
std::string | getResourceName () const |
Protected Member Functions | |
HlslShaderTextureResource (const std::string &sResourceName, std::unique_ptr< TextureHandle > pTextureToUse, const std::unordered_map< DirectXPso *, UINT > &rootParameterIndices) | |
virtual std::optional< Error > | onAfterAllPipelinesRefreshedResources () override |
Protected Member Functions inherited from ne::ShaderTextureResource | |
ShaderTextureResource (const std::string &sResourceName) | |
Protected Member Functions inherited from ne::ShaderResourceBase | |
ShaderResourceBase (const std::string &sResourceName) | |
virtual std::optional< Error > | onAfterAllPipelinesRefreshedResources ()=0 |
Static Private Member Functions | |
static std::variant< std::unique_ptr< ShaderTextureResource >, Error > | create (const std::string &sShaderResourceName, const std::unordered_set< Pipeline * > &pipelinesToUse, std::unique_ptr< TextureHandle > pTextureToUse) |
Private Attributes | |
std::pair< std::mutex, std::unique_ptr< TextureHandle > > | mtxUsedTexture |
DirectXDescriptor * | pTextureSrv = nullptr |
DirectXDescriptorHeap * | pSrvHeap = nullptr |
UINT | iSrvDescriptorSize = 0 |
std::pair< std::recursive_mutex, std::unordered_map< DirectXPso *, UINT > > | mtxRootParameterIndices |
Friends | |
class | ShaderTextureResourceManager |
References some texture from shader code.
|
protected |
Initializes the resource.
sResourceName | Name of the resource we are referencing (should be exactly the same as the resource name written in the shader file we are referencing). |
pTextureToUse | Texture to which a descriptor should be binded. |
rootParameterIndices | Indices of this resource in root signature. |
|
overridevirtual |
Called to make the resource to discard currently used pipelines and bind/reference other pipelines.
draw
function while this function is not finished (i.e. make sure the CPU will not queue a new frame while this function is not finished).pipelinesToUse | Pipelines to use instead of the current ones. |
Implements ne::ShaderResourceBase.
|
staticprivate |
Creates a new HLSL shader resource.
sShaderResourceName | Name of the resource we are referencing (should be exactly the same as the resource name written in the shader file we are referencing). |
pipelinesToUse | Pipelines that use shader/parameters we are referencing. |
pTextureToUse | Texture to which a descriptor should be binded. |
|
overrideprotectedvirtual |
Called from pipeline manager to notify that all pipelines released their internal resources and now restored them so their internal resources (for example push constants) might be different now and shader resource now needs to check that everything that it needs is still there and possibly re-bind to pipeline's descriptors since these might have been also re-created.
Implements ne::ShaderResourceBase.
|
inline |
Adds a new command to the specified command list to use this shader resource.
pCommandList | Command list to add new command to. |
|
inline |
Adds a new command to the specified command list to use this shader resource.
pCommandList | Command list to add new command to. |
pUsedPipeline | Current pipeline. |
|
overridevirtual |
Makes the shader resource to reference the new (specified) texture.
draw
function while this function is not finished (i.e. make sure the CPU will not queue a new frame while this function is not finished).pTextureToUse | Texture to reference. |
Implements ne::ShaderTextureResource.
|
private |
Size of one SRV descriptor.
|
private |
Indices of this resource in root signature to bind this resource during the draw operation.
|
private |
Texture to which a descriptor should be binded.
|
private |
SRV heap.
|
private |
Descriptor binded to mtxUsedTexture.