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 --- .../GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp index 7014d51b..07bed5f2 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp @@ -143,7 +143,7 @@ PipelineStateVkImpl :: PipelineStateVkImpl(IReferenceCounters* pRefCounters for (Uint32 s=0; s < m_NumShaders; ++s) { new (m_ShaderResourceLayouts + s) ShaderResourceLayoutVk(*this, LogicalDevice, GetRawAllocator()); - auto *pShaderVk = ValidatedCast(m_ppShaders[s]); + auto* pShaderVk = GetShader(s); ShaderResources[s] = pShaderVk->GetShaderResources(); ShaderSPIRVs[s] = pShaderVk->GetSPIRV(); } @@ -171,7 +171,7 @@ PipelineStateVkImpl :: PipelineStateVkImpl(IReferenceCounters* pRefCounters std::array ShaderStages = {}; for (Uint32 s = 0; s < m_NumShaders; ++s) { - auto *pShader = m_ppShaders[s]; + auto* pShader = m_ppShaders[s]; auto ShaderType = pShader->GetDesc().ShaderType; auto& StageCI = ShaderStages[s]; @@ -441,7 +441,7 @@ void PipelineStateVkImpl::BindShaderResources(IResourceMapping *pResourceMapping void PipelineStateVkImpl::CreateShaderResourceBinding(IShaderResourceBinding **ppShaderResourceBinding) { - auto *pRenderDeviceVk = GetDevice(); + auto* pRenderDeviceVk = GetDevice(); auto& SRBAllocator = pRenderDeviceVk->GetSRBAllocator(); auto pResBindingVk = NEW_RC_OBJ(SRBAllocator, "ShaderResourceBindingVkImpl instance", ShaderResourceBindingVkImpl)(this, false); pResBindingVk->QueryInterface(IID_ShaderResourceBinding, reinterpret_cast(ppShaderResourceBinding)); @@ -470,15 +470,15 @@ bool PipelineStateVkImpl::IsCompatibleWith(const IPipelineState *pPSO)const { for (Uint32 s = 0; s < m_NumShaders; ++s) { - auto *pShader0 = ValidatedCast(m_ppShaders[s]); - auto *pShader1 = ValidatedCast(pPSOVk->m_ppShaders[s]); + auto* pShader0 = GetShader(s); + auto* pShader1 = pPSOVk->GetShader(s); if (pShader0->GetDesc().ShaderType != pShader1->GetDesc().ShaderType) { IsCompatibleShaders = false; break; } - const auto *pRes0 = pShader0->GetShaderResources().get(); - const auto *pRes1 = pShader1->GetShaderResources().get(); + const auto* pRes0 = pShader0->GetShaderResources().get(); + const auto* pRes1 = pShader1->GetShaderResources().get(); if (!pRes0->IsCompatibleWith(*pRes1)) { IsCompatibleShaders = false; @@ -514,11 +514,11 @@ void PipelineStateVkImpl::CommitAndTransitionShaderResources(IShaderResourceBind // If the shaders contain no resources or static resources only, shader resource binding may be null. // In this case use special internal SRB object - auto *pResBindingVkImpl = pShaderResourceBinding ? ValidatedCast(pShaderResourceBinding) : m_pDefaultShaderResBinding.get(); + auto* pResBindingVkImpl = pShaderResourceBinding ? ValidatedCast(pShaderResourceBinding) : m_pDefaultShaderResBinding.get(); #ifdef VERIFY_SHADER_BINDINGS { - auto *pRefPSO = pResBindingVkImpl->GetPipelineState(); + auto* pRefPSO = pResBindingVkImpl->GetPipelineState(); if ( IsIncompatibleWith(pRefPSO) ) { LOG_ERROR_MESSAGE("Shader resource binding is incompatible with the pipeline state \"", m_Desc.Name, "\". Operation will be ignored."); @@ -534,7 +534,7 @@ void PipelineStateVkImpl::CommitAndTransitionShaderResources(IShaderResourceBind { for (Uint32 s = 0; s < m_NumShaders; ++s) { - auto *pShaderVk = ValidatedCast( m_ppShaders[s] ); + auto* pShaderVk = GetShader(s); #ifdef VERIFY_SHADER_BINDINGS pShaderVk->DbgVerifyStaticResourceBindings(); #endif -- cgit v1.2.3