message: Fixed issue with destruction of ShaderResourceBindingBase
diff: @@ -74,6 +74,8 @@ public:
  TObjectBase{pRefCounters},
  m_pPRS{pPRS},
  m_ShaderResourceCache{ResourceCacheContentType::SRB}
  + {
  + try
  {
  m_ActiveShaderStageIndex.fill(-1);
  @@ -95,13 +97,13 @@ public:
  "Constructor of ShaderVariableManagerImplType must be noexcept, so we can safely construct all managers");
  m_pShaderVarMgrs = MemPool.ConstructArray<ShaderVariableManagerImplType>(NumShaders, std::ref(*this), std::ref(m_ShaderResourceCache));
  - // The memory is now owned by ShaderResourceBindingBase and will be freed by destructor.
  + // The memory is now owned by ShaderResourceBindingBase and will be freed by Destruct().
  auto* Ptr = MemPool.ReleaseOwnership();
  VERIFY_EXPR(Ptr == m_pShaderVarMgrs);
  (void)Ptr;
  // It is important to construct all objects before initializing them because if an exception is thrown,
  - // destructors will be called for all objects
  + // Destruct() will call destructors for all non-null objects.
  pPRS->InitSRBResourceCache(m_ShaderResourceCache);
  @@ -121,22 +123,18 @@ public:
  m_pShaderVarMgrs[MgrInd].Initialize(*pPRS, VarDataAllocator, VarTypes, _countof(VarTypes), ShaderType);
  }
  }
  -
  - ~ShaderResourceBindingBase()
  - {
  - if (m_pShaderVarMgrs != nullptr)
  - {
  - auto& SRBMemAllocator = GetSignature()->GetSRBMemoryAllocator();
  - for (Uint32 s = 0; s < GetNumShaders(); ++s)
  + catch (...)
  {
  - auto& VarDataAllocator = SRBMemAllocator.GetShaderVariableDataAllocator(s);
  - m_pShaderVarMgrs[s].Destroy(VarDataAllocator);
  - m_pShaderVarMgrs[s].~ShaderVariableManagerImplType();
  - }
  - GetRawAllocator().Free(m_pShaderVarMgrs);
  + // We must release objects manually as destructor will not be called.
  + Destruct();
  + throw;
  }
  }
  + ~ShaderResourceBindingBase()
  + {
  + Destruct();
  + }
  IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_ShaderResourceBinding, TObjectBase)
  @@ -261,6 +259,22 @@ public:
  ShaderResourceCacheImplType& GetResourceCache() { return m_ShaderResourceCache; }
  const ShaderResourceCacheImplType& GetResourceCache() const { return m_ShaderResourceCache; }
  +private:
  + void Destruct()
  + {
  + if (m_pShaderVarMgrs != nullptr)
  + {
  + auto& SRBMemAllocator = GetSignature()->GetSRBMemoryAllocator();
  + for (Uint32 s = 0; s < GetNumShaders(); ++s)
  + {
  + auto& VarDataAllocator = SRBMemAllocator.GetShaderVariableDataAllocator(s);
  + m_pShaderVarMgrs[s].Destroy(VarDataAllocator);
  + m_pShaderVarMgrs[s].~ShaderVariableManagerImplType();
  + }
  + GetRawAllocator().Free(m_pShaderVarMgrs);
  + }
  + }
  +
  protected:
  /// Strong reference to pipeline resource signature. We must use strong reference, because
  /// shader resource binding uses pipeline resource signature's memory allocator to allocate
  