diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-01-26 21:58:37 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-01-26 21:58:37 +0000 |
| commit | 337226019e67753a5a33783cd83731db907a52a3 (patch) | |
| tree | 1d46f2353bd553e1c64d9bdbcd53c2b986af7812 /Graphics/GraphicsEngineVulkan | |
| parent | minor improvements (diff) | |
| download | DiligentCore-337226019e67753a5a33783cd83731db907a52a3.tar.gz DiligentCore-337226019e67753a5a33783cd83731db907a52a3.zip | |
Some code cleanup
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
3 files changed, 16 insertions, 13 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp index 3dfb7a4b..895b13cf 100644 --- a/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp +++ b/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp @@ -167,11 +167,9 @@ public: struct ImmutableSamplerAttribs { RefCntAutoPtr<ISampler> Ptr; - Uint32 DescrSet : 16; - Uint32 BindingIndex : 16; - ImmutableSamplerAttribs() : - DescrSet{~0u}, BindingIndex{~0u} {} + Uint32 DescrSet = ~0u; + Uint32 BindingIndex = ~0u; }; const ImmutableSamplerAttribs& GetImmutableSamplerAttribs(Uint32 SampIndex) const diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.hpp index 56ccf5c6..c3fbee22 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.hpp +++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.hpp @@ -88,8 +88,9 @@ private: ShaderResourceCacheVk m_ShaderResourceCache; ShaderVariableManagerVk* m_pShaderVarMgrs = nullptr; - bool m_bStaticResourcesInitialized = false; - Uint8 m_NumShaders = 0; + bool m_bStaticResourcesInitialized = false; + + const Uint8 m_NumShaders = 0; }; } // namespace Diligent diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp index b51d74b6..b5a1dc96 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp @@ -512,18 +512,22 @@ void PipelineResourceSignatureVkImpl::CreateLayout(const CacheOffsetsType& Cache VERIFY_EXPR(BindingIndices[CACHE_GROUP_DYN_SB_DYN_VAR] == BindingCount[CACHE_GROUP_DYN_UB_DYN_VAR] + BindingCount[CACHE_GROUP_DYN_SB_DYN_VAR]); VERIFY_EXPR(BindingIndices[CACHE_GROUP_OTHER_DYN_VAR] == BindingCount[CACHE_GROUP_DYN_UB_DYN_VAR] + BindingCount[CACHE_GROUP_DYN_SB_DYN_VAR] + BindingCount[CACHE_GROUP_OTHER_DYN_VAR]); - // Add immutable samplers that is not exist in m_Desc.Resources - // If static/mutable descriptor set layout is empty, then add samplers to dynamic layout. + // Add immutable samplers that do not exist in m_Desc.Resources. for (Uint32 i = 0; i < m_Desc.NumImmutableSamplers; ++i) { - auto& ImmutableSampler = m_ImmutableSamplers[i]; - const auto& SamplerDesc = m_Desc.ImmutableSamplers[i]; - const Uint32 SetIdx = (DSMapping[0] < MAX_DESCR_SET_PER_SIGNATURE ? 0 : 1); - auto& BindingIndex = BindingIndices[SetIdx * 3 + 2]; - + auto& ImmutableSampler = m_ImmutableSamplers[i]; if (ImmutableSampler.Ptr) continue; + const auto& SamplerDesc = m_Desc.ImmutableSamplers[i]; + // If static/mutable descriptor set layout is empty, then add samplers to dynamic set. + const Uint32 SetIdx = (DSMapping[0] < MAX_DESCR_SET_PER_SIGNATURE ? 0 : 1); + DEV_CHECK_ERR(DSMapping[SetIdx] < MAX_DESCR_SET_PER_SIGNATURE, + "There are no descriptor sets in this singature, which indicates there are no other " + "resources besides immutable samplers. This is not currently allowed."); + + auto& BindingIndex = BindingIndices[SetIdx * 3 + CACHE_GROUP_OTHER]; + GetDevice()->CreateSampler(SamplerDesc.Desc, &ImmutableSampler.Ptr); ImmutableSampler.DescrSet = DSMapping[SetIdx]; |
