From ea25e99aaca4dd9c4a442d9ce39a5365aaf72bc1 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Thu, 28 Feb 2019 00:29:49 -0800 Subject: Fixed some issues in Vk backend --- .../include/ShaderResourceLayoutVk.h | 2 +- .../GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp | 18 +++++++++--------- .../src/ShaderResourceLayoutVk.cpp | 7 ++++--- 3 files changed, 14 insertions(+), 13 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h b/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h index b4712d70..c3dd9146 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h @@ -142,7 +142,7 @@ public: std::vector SPIRVs[], class PipelineLayout& PipelineLayout); - // sizeof(VkResource) == 24 (x64) - TODO: Verify + // sizeof(VkResource) == 24 (x64) struct VkResource { VkResource (const VkResource&) = delete; diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp index 14f4c962..443076df 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp @@ -625,31 +625,31 @@ void PipelineStateVkImpl::BindStaticResources(IResourceMapping* pResourceMapping Uint32 PipelineStateVkImpl::GetStaticVariableCount(SHADER_TYPE ShaderType) const { - const auto ShaderTypeInd = GetShaderTypeIndex(ShaderType); - if (ShaderTypeInd < 0) + const auto LayoutInd = m_ResourceLayoutIndex[GetShaderTypeIndex(ShaderType)]; + if (LayoutInd < 0) return 0; - auto& StaticVarMgr = GetStaticVarMgr(ShaderTypeInd); + auto& StaticVarMgr = GetStaticVarMgr(LayoutInd); return StaticVarMgr.GetVariableCount(); } IShaderResourceVariable* PipelineStateVkImpl::GetStaticShaderVariable(SHADER_TYPE ShaderType, const Char* Name) { - const auto ShaderTypeInd = GetShaderTypeIndex(ShaderType); - if (ShaderTypeInd < 0) + const auto LayoutInd = m_ResourceLayoutIndex[GetShaderTypeIndex(ShaderType)]; + if (LayoutInd < 0) return nullptr; - auto& StaticVarMgr = GetStaticVarMgr(ShaderTypeInd); + auto& StaticVarMgr = GetStaticVarMgr(LayoutInd); return StaticVarMgr.GetVariable(Name); } IShaderResourceVariable* PipelineStateVkImpl::GetStaticShaderVariable(SHADER_TYPE ShaderType, Uint32 Index) { - const auto ShaderTypeInd = GetShaderTypeIndex(ShaderType); - if (ShaderTypeInd < 0) + const auto LayoutInd = m_ResourceLayoutIndex[GetShaderTypeIndex(ShaderType)]; + if (LayoutInd < 0) return nullptr; - auto& StaticVarMgr = GetStaticVarMgr(ShaderTypeInd); + auto& StaticVarMgr = GetStaticVarMgr(LayoutInd); return StaticVarMgr.GetVariable(Index); } diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp index a0835334..201fadc6 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp @@ -154,7 +154,8 @@ void ShaderResourceLayoutVk::AllocateMemory(std::shared_ptrGetShaderType(); - const auto* CombinedSamplerSuffix = pSrcResources->GetCombinedSamplerSuffix(); + const auto ShaderType = m_pResources->GetShaderType(); + const auto* CombinedSamplerSuffix = m_pResources->GetCombinedSamplerSuffix(); m_pResources->ProcessResources( [&](const SPIRVShaderResourceAttribs& Attribs, Uint32) -- cgit v1.2.3