diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-03-08 08:13:00 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-03-19 00:38:17 +0000 |
| commit | 1236220647276ad81692becafa32ee9d374d269e (patch) | |
| tree | bb4a65ac072031344d1518691dbeb9c30b40d885 /Graphics/GraphicsEngine | |
| parent | Unified implementations of SRB in D3D12, Vk and GL (diff) | |
| download | DiligentCore-1236220647276ad81692becafa32ee9d374d269e.tar.gz DiligentCore-1236220647276ad81692becafa32ee9d374d269e.zip | |
ShaderResourceBinding{D3D12, Vk, GL} - removed the remaining duplicate code
Diffstat (limited to 'Graphics/GraphicsEngine')
| -rw-r--r-- | Graphics/GraphicsEngine/include/ShaderResourceBindingBase.hpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Graphics/GraphicsEngine/include/ShaderResourceBindingBase.hpp b/Graphics/GraphicsEngine/include/ShaderResourceBindingBase.hpp index 64c31e9d..3dc62905 100644 --- a/Graphics/GraphicsEngine/include/ShaderResourceBindingBase.hpp +++ b/Graphics/GraphicsEngine/include/ShaderResourceBindingBase.hpp @@ -31,6 +31,7 @@ /// Implementation of the Diligent::ShaderResourceBindingBase template class #include <array> +#include <functional> #include "PrivateConstants.h" #include "ShaderResourceBinding.h" @@ -103,6 +104,25 @@ public: // It is important to construct all objects before initializing them because if an exception is thrown, // destructors will be called for all objects + + pPRS->InitSRBResourceCache(m_ShaderResourceCache); + + auto& SRBMemAllocator = pPRS->GetSRBMemoryAllocator(); + for (Uint32 s = 0; s < NumShaders; ++s) + { + const auto ShaderType = pPRS->GetActiveShaderStageType(s); + const auto ShaderInd = GetShaderTypePipelineIndex(ShaderType, pPRS->GetPipelineType()); + const auto MgrInd = m_ActiveShaderStageIndex[ShaderInd]; + VERIFY_EXPR(MgrInd >= 0 && MgrInd < static_cast<int>(NumShaders)); + + auto& VarDataAllocator = SRBMemAllocator.GetShaderVariableDataAllocator(s); + + // Create shader variable manager in place + // Initialize vars manager to reference mutable and dynamic variables + // Note that the cache has space for all variable types + const SHADER_RESOURCE_VARIABLE_TYPE VarTypes[] = {SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE, SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC}; + m_pShaderVarMgrs[MgrInd].Initialize(*pPRS, VarDataAllocator, VarTypes, _countof(VarTypes), ShaderType); + } } ~ShaderResourceBindingBase() |
