summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-02-28 08:29:49 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-02-28 08:29:49 +0000
commitea25e99aaca4dd9c4a442d9ce39a5365aaf72bc1 (patch)
treec22b023a6116be2b3f1b6dd46c82e9e8b271584a /Graphics/GraphicsEngineVulkan
parentFinished refactoring pipeline layout definition in Vk backend (diff)
downloadDiligentCore-ea25e99aaca4dd9c4a442d9ce39a5365aaf72bc1.tar.gz
DiligentCore-ea25e99aaca4dd9c4a442d9ce39a5365aaf72bc1.zip
Fixed some issues in Vk backend
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp18
-rw-r--r--Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp7
3 files changed, 14 insertions, 13 deletions
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<uint32_t> 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_ptr<const SPIRVShaderRes
for(Uint32 s=0; s < m_NumImmutableSamplers; ++s)
{
// We need to initialize immutable samplers
- new(&GetImmutableSampler(s)) ImmutableSamplerPtrType;
+ auto& UninitializedImmutableSampler = GetImmutableSampler(s);
+ new(std::addressof(UninitializedImmutableSampler)) ImmutableSamplerPtrType;
}
}
@@ -171,8 +172,8 @@ void ShaderResourceLayoutVk::InitializeStaticResourceLayout(std::shared_ptr<cons
Uint32 StaticResCacheSize = 0;
const Uint32 AllowedTypeBits = GetAllowedTypeBits(&AllowedVarType, 1);
- const auto ShaderType = pSrcResources->GetShaderType();
- const auto* CombinedSamplerSuffix = pSrcResources->GetCombinedSamplerSuffix();
+ const auto ShaderType = m_pResources->GetShaderType();
+ const auto* CombinedSamplerSuffix = m_pResources->GetCombinedSamplerSuffix();
m_pResources->ProcessResources(
[&](const SPIRVShaderResourceAttribs& Attribs, Uint32)