6#include <unordered_set>
10#include "shader/general/resources/ShaderResource.h"
11#include "render/directx/descriptors/DirectXDescriptorHeap.h"
34 const ComPtr<ID3D12GraphicsCommandList>& pCommandList)
const {
52 Error error(std::format(
53 "shader resource \"{}\" was requested to set its graphics root descriptor "
54 "table of the only used pipeline but this shader resource references "
64 pCommandList->SetGraphicsRootDescriptorTable(
66 D3D12_GPU_DESCRIPTOR_HANDLE{
67 pSrvHeap->getInternalHeap()->GetGPUDescriptorHandleForHeapStart().ptr +
68 pTextureSrv->getDescriptorOffsetInDescriptors() * iSrvDescriptorSize});
78 const ComPtr<ID3D12GraphicsCommandList>& pCommandList,
DirectXPso* pUsedPipeline)
const {
86 Error error(std::format(
87 "shader resource \"{}\" was requested to set its graphics root descriptor table "
88 "but this shader resource does not reference the specified pipeline",
97 pCommandList->SetGraphicsRootDescriptorTable(
99 D3D12_GPU_DESCRIPTOR_HANDLE{
100 pSrvHeap->getInternalHeap()->GetGPUDescriptorHandleForHeapStart().ptr +
101 pTextureSrv->getDescriptorOffsetInDescriptors() * iSrvDescriptorSize});
115 [[nodiscard]]
virtual std::optional<Error>
116 useNewTexture(std::unique_ptr<TextureHandle> pTextureToUse)
override;
134 [[nodiscard]]
virtual std::optional<Error>
150 std::unique_ptr<TextureHandle> pTextureToUse,
151 const std::unordered_map<DirectXPso*, UINT>& rootParameterIndices);
175 static std::variant<std::unique_ptr<ShaderTextureResource>,
Error>
create(
176 const std::string& sShaderResourceName,
177 const std::unordered_set<Pipeline*>& pipelinesToUse,
178 std::unique_ptr<TextureHandle> pTextureToUse);
Definition: DirectXDescriptorHeap.h:198
Definition: DirectXDescriptor.h:18
Definition: DirectXPso.h:22
std::string getFullErrorMessage() const
Definition: Error.cpp:84
void showError() const
Definition: Error.cpp:102
Definition: HlslShaderTextureResource.h:18
virtual std::optional< Error > changeUsedPipelines(const std::unordered_set< Pipeline * > &pipelinesToUse) override
Definition: HlslShaderTextureResource.cpp:170
virtual std::optional< Error > useNewTexture(std::unique_ptr< TextureHandle > pTextureToUse) override
Definition: HlslShaderTextureResource.cpp:136
DirectXDescriptor * pTextureSrv
Definition: HlslShaderTextureResource.h:184
void setGraphicsRootDescriptorTableOfPipeline(const ComPtr< ID3D12GraphicsCommandList > &pCommandList, DirectXPso *pUsedPipeline) const
Definition: HlslShaderTextureResource.h:77
virtual std::optional< Error > onAfterAllPipelinesRefreshedResources() override
Definition: HlslShaderTextureResource.cpp:114
DirectXDescriptorHeap * pSrvHeap
Definition: HlslShaderTextureResource.h:187
std::pair< std::recursive_mutex, std::unordered_map< DirectXPso *, UINT > > mtxRootParameterIndices
Definition: HlslShaderTextureResource.h:193
std::pair< std::mutex, std::unique_ptr< TextureHandle > > mtxUsedTexture
Definition: HlslShaderTextureResource.h:181
UINT iSrvDescriptorSize
Definition: HlslShaderTextureResource.h:190
void setGraphicsRootDescriptorTableOfOnlyPipeline(const ComPtr< ID3D12GraphicsCommandList > &pCommandList) const
Definition: HlslShaderTextureResource.h:33
static std::variant< std::unique_ptr< ShaderTextureResource >, Error > create(const std::string &sShaderResourceName, const std::unordered_set< Pipeline * > &pipelinesToUse, std::unique_ptr< TextureHandle > pTextureToUse)
Definition: HlslShaderTextureResource.cpp:16
std::string sResourceName
Definition: ShaderResource.h:82
std::string getResourceName() const
Definition: ShaderResource.cpp:12
Definition: ShaderTextureResourceManager.h:27
Definition: ShaderResource.h:86