From ecd151d725ec446be7718995ed110de1678d7d8f Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Tue, 26 Jun 2018 21:14:20 -0700 Subject: Reworked shader memory alloction for resource layouts in D3D12 pipeline implementation --- Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h | 4 ++-- Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h index 97ab9ba7..6823dbb0 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h @@ -63,8 +63,8 @@ public: ID3DBlob* GetBytecode(){return m_pShaderByteCode;} ShaderResourceLayoutD3D11& GetStaticResourceLayout(){return m_StaticResLayout;} - const std::shared_ptr& GetResources(){return m_pShaderResources;} - Uint32 GetShaderTypeIndex(){return m_ShaderTypeIndex;} + const std::shared_ptr& GetResources()const{return m_pShaderResources;} + Uint32 GetShaderTypeIndex()const{return m_ShaderTypeIndex;} private: diff --git a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp index 4241eb31..cd91edef 100644 --- a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp @@ -119,7 +119,7 @@ PipelineStateD3D11Impl::PipelineStateD3D11Impl(IReferenceCounters* pRefCoun std::array ShaderResCacheDataSizes = {}; for (Uint32 s = 0; s < m_NumShaders; ++s) { - auto* pShader = ValidatedCast(m_ppShaders[s]); + auto* pShader = GetShader(s); const auto& ShaderResources = *pShader->GetResources(); std::array AllowedVarTypes = { SHADER_VARIABLE_TYPE_MUTABLE, SHADER_VARIABLE_TYPE_DYNAMIC }; ShaderResLayoutDataSizes[s] = ShaderResourceLayoutD3D11::GetRequiredMemorySize(ShaderResources, AllowedVarTypes.data(), static_cast(AllowedVarTypes.size())); @@ -201,8 +201,8 @@ bool PipelineStateD3D11Impl::IsCompatibleWith(const IPipelineState* pPSO)const for (Uint32 s = 0; s < m_NumShaders; ++s) { - auto* pShader0 = ValidatedCast(m_ppShaders[s]); - auto* pShader1 = ValidatedCast(pPSOD3D11->m_ppShaders[s]); + auto* pShader0 = GetShader(s); + auto* pShader1 = pPSOD3D11->GetShader(s); if (pShader0->GetShaderTypeIndex() != pShader1->GetShaderTypeIndex()) return false; const ShaderResourcesD3D11* pRes0 = pShader0->GetResources().get(); -- cgit v1.2.3