From 780534515509243b7e88e291a330f1fd33aaca93 Mon Sep 17 00:00:00 2001 From: assiduous Date: Thu, 4 Mar 2021 20:46:55 -0800 Subject: Unified CreateShaderResourceBinding in D3D12, Vk and GL signatures --- .../include/PipelineResourceSignatureBase.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp index 85c3fcd1..68d4aa8a 100644 --- a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp +++ b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp @@ -87,6 +87,12 @@ public: // Shader variable manager implementation type (ShaderVariableManagerD3D12, ShaderVariableManagerVk, etc.) using ShaderVariableManagerImplType = typename EngineImplTraits::ShaderVariableManagerImplType; + // Shader resource binding implementation type (ShaderResourceBindingD3D12Impl, ShaderResourceBindingVkImpl, etc.) + using ShaderResourceBindingImplType = typename EngineImplTraits::ShaderResourceBindingImplType; + + // Pipeline resource signature implementation type (PipelineResourceSignatureD3D12Impl, PipelineResourceSignatureVkImpl, etc.) + using PipelineResourceSignatureImplType = typename EngineImplTraits::PipelineResourceSignatureImplType; + using TDeviceObjectBase = DeviceObjectBase; /// \param pRefCounters - Reference counters object that controls the lifetime of this resource signature. @@ -522,6 +528,17 @@ protected: pSRB->SetStaticResourcesInitialized(); } + void CreateShaderResourceBindingImpl(IShaderResourceBinding** ppShaderResourceBinding, + bool InitStaticResources) + { + auto* pThisImpl{static_cast(this)}; + auto& SRBAllocator{pThisImpl->m_pDevice->GetSRBAllocator()}; + auto* pResBindingImpl{NEW_RC_OBJ(SRBAllocator, "ShaderResourceBinding instance", ShaderResourceBindingImplType)(pThisImpl)}; + if (InitStaticResources) + pThisImpl->InitializeStaticSRBResources(pResBindingImpl); + pResBindingImpl->QueryInterface(IID_ShaderResourceBinding, reinterpret_cast(ppShaderResourceBinding)); + } + // 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. -- cgit v1.2.3