From 60c4c905b88b99cc9aa931a188afd4ddbba42f8f Mon Sep 17 00:00:00 2001 From: assiduous Date: Tue, 22 Dec 2020 16:50:36 -0800 Subject: PSO initialization: updated shader stage initialization --- .../include/PipelineStateD3D11Impl.hpp | 4 ++-- .../src/PipelineStateD3D11Impl.cpp | 21 ++++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp index 9614ebab..a493f48a 100644 --- a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp +++ b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp @@ -140,8 +140,8 @@ private: template void InitInternalObjects(const PSOCreateInfoType& CreateInfo); - void InitResourceLayouts(const PipelineStateCreateInfo& CreateInfo, - const std::vector>& ShaderStages); + void InitResourceLayouts(const PipelineStateCreateInfo& CreateInfo, + const std::vector& Shaders); void Destruct(); diff --git a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp index dd3566b8..662567ec 100644 --- a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp @@ -40,11 +40,11 @@ void PipelineStateD3D11Impl::InitInternalObjects(const PSOCreateInfoType& Create { m_ResourceLayoutIndex.fill(-1); - std::vector> ShaderStages; - ExtractShaders(CreateInfo, ShaderStages); + std::vector Shaders; + ExtractShaders(CreateInfo, Shaders); const auto NumShaderStages = GetNumShaderStages(); - VERIFY_EXPR(NumShaderStages > 0 && NumShaderStages == ShaderStages.size()); + VERIFY_EXPR(NumShaderStages > 0 && NumShaderStages == Shaders.size()); FixedLinearAllocator MemPool{GetRawAllocator()}; @@ -71,7 +71,7 @@ void PipelineStateD3D11Impl::InitInternalObjects(const PSOCreateInfoType& Create // It is important to construct all objects before initializing them because if an exception is thrown, // destructors will be called for all objects - InitResourceLayouts(CreateInfo, ShaderStages); + InitResourceLayouts(CreateInfo, Shaders); } @@ -230,18 +230,17 @@ void PipelineStateD3D11Impl::Destruct() IMPLEMENT_QUERY_INTERFACE(PipelineStateD3D11Impl, IID_PipelineStateD3D11, TPipelineStateBase) -void PipelineStateD3D11Impl::InitResourceLayouts(const PipelineStateCreateInfo& CreateInfo, - const std::vector>& ShaderStages) +void PipelineStateD3D11Impl::InitResourceLayouts(const PipelineStateCreateInfo& CreateInfo, + const std::vector& Shaders) { const auto& ResourceLayout = m_Desc.ResourceLayout; #ifdef DILIGENT_DEVELOPMENT { const ShaderResources* pResources[MAX_SHADERS_IN_PIPELINE] = {}; - for (Uint32 s = 0; s < ShaderStages.size(); ++s) + for (Uint32 s = 0; s < Shaders.size(); ++s) { - auto* pShader = ShaderStages[s].second; - pResources[s] = &(*pShader->GetD3D11Resources()); + pResources[s] = Shaders[s]->GetD3D11Resources().get(); } ShaderResources::DvpVerifyResourceLayout(ResourceLayout, pResources, GetNumShaderStages(), (CreateInfo.Flags & PSO_CREATE_FLAG_IGNORE_MISSING_VARIABLES) == 0, @@ -253,9 +252,9 @@ void PipelineStateD3D11Impl::InitResourceLayouts(const PipelineStateCreateInfo& std::array ShaderResLayoutDataSizes = {}; std::array ShaderResCacheDataSizes = {}; - for (Uint32 s = 0; s < ShaderStages.size(); ++s) + for (Uint32 s = 0; s < Shaders.size(); ++s) { - const auto* pShader = ShaderStages[s].second; + const auto* pShader = Shaders[s]; const auto& ShaderDesc = pShader->GetDesc(); const auto& Resources = *pShader->GetD3D11Resources(); VERIFY_EXPR(ShaderDesc.ShaderType == Resources.GetShaderType()); -- cgit v1.2.3