summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp48
1 files changed, 25 insertions, 23 deletions
diff --git a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp
index 72423b51..ce849246 100644
--- a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp
+++ b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp
@@ -242,6 +242,31 @@ public:
pResBindingImpl->QueryInterface(IID_ShaderResourceBinding, reinterpret_cast<IObject**>(ppShaderResourceBinding));
}
+ /// Implementation of IPipelineResourceSignature::InitializeStaticSRBResources.
+ virtual void DILIGENT_CALL_TYPE InitializeStaticSRBResources(IShaderResourceBinding* pSRB) const override final
+ {
+ DEV_CHECK_ERR(pSRB != nullptr, "SRB must not be null");
+
+ auto* const pSRBImpl = ValidatedCast<ShaderResourceBindingImplType>(pSRB);
+ if (pSRBImpl->StaticResourcesInitialized())
+ {
+ LOG_WARNING_MESSAGE("Static resources have already been initialized in this shader resource binding object.");
+ return;
+ }
+
+ const auto* const pThisImpl = static_cast<const PipelineResourceSignatureImplType*>(this);
+#ifdef DILIGENT_DEVELOPMENT
+ {
+ const auto* pSRBSignature = pSRBImpl->GetPipelineResourceSignature();
+ DEV_CHECK_ERR(pSRBSignature->IsCompatibleWith(pThisImpl), "Shader resource binding is not compatible with resource signature '", pThisImpl->m_Desc.Name, "'.");
+ }
+#endif
+
+ auto& ResourceCache = pSRBImpl->GetResourceCache();
+ pThisImpl->CopyStaticResources(ResourceCache);
+
+ pSRBImpl->SetStaticResourcesInitialized();
+ }
size_t GetHash() const { return m_Hash; }
@@ -488,29 +513,6 @@ protected:
#endif
}
- template <typename SRBImplType, typename InitResourcesHandler>
- void InitializeStaticSRBResourcesImpl(SRBImplType* pSRB, InitResourcesHandler Handler) const
- {
- DEV_CHECK_ERR(pSRB != nullptr, "SRB must not be null");
- if (pSRB->StaticResourcesInitialized())
- {
- LOG_WARNING_MESSAGE("Static resources have already been initialized in this shader resource binding object.");
- return;
- }
-
- const auto* const pSRBSignature = pSRB->GetPipelineResourceSignature();
-#ifdef DILIGENT_DEVELOPMENT
- if (!pSRBSignature->IsCompatibleWith(this))
- {
- LOG_ERROR_MESSAGE("Shader resource binding is not compatible with resource signature '", this->m_Desc.Name, "'.");
- }
-#endif
-
- Handler(pSRB);
-
- pSRB->SetStaticResourcesInitialized();
- }
-
// Finds a sampler that is assigned to texture Tex, when combined texture samplers are used.
// Returns an index of the sampler in m_Desc.Resources array, or InvalidSamplerValue if there is
// no such sampler, or if combined samplers are not used.