From 0b043b001d295b6d15a36394fe167f241d0470a4 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Mon, 28 May 2018 11:17:58 -0700 Subject: Some minor updates --- Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.h | 9 +++++++++ Graphics/GraphicsEngineVulkan/include/ShaderVariableVk.h | 6 +++--- Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp | 7 ++++++- Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp | 6 ++++-- 4 files changed, 22 insertions(+), 6 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.h b/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.h index 8cb9e638..f2129a41 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.h @@ -88,6 +88,10 @@ public: // sizeof(Resource) == 16 (x64, msvc, Release) struct Resource { + Resource(SPIRVShaderResourceAttribs::ResourceType _Type) : + Type(_Type) + {} + Resource(const Resource&) = delete; Resource(Resource&&) = delete; Resource& operator = (const Resource&) = delete; @@ -111,6 +115,11 @@ public: m_pResources (pResources) {} + DescriptorSet(const DescriptorSet&) = delete; + DescriptorSet(DescriptorSet&&) = delete; + DescriptorSet& operator = (const DescriptorSet&) = delete; + DescriptorSet& operator = (DescriptorSet&&) = delete; + inline Resource& GetResource(Uint32 CacheOffset) { VERIFY(CacheOffset < m_NumResources, "Offset ", CacheOffset, " is out of range" ); diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderVariableVk.h b/Graphics/GraphicsEngineVulkan/include/ShaderVariableVk.h index a1a7c552..e533a4b0 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderVariableVk.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderVariableVk.h @@ -117,10 +117,10 @@ public: m_Resource(Resource) {} - ShaderVariableVkImpl(const ShaderVariableVkImpl&) = delete; - ShaderVariableVkImpl(ShaderVariableVkImpl&&) = delete; + ShaderVariableVkImpl (const ShaderVariableVkImpl&) = delete; + ShaderVariableVkImpl (ShaderVariableVkImpl&&) = delete; ShaderVariableVkImpl& operator= (const ShaderVariableVkImpl&) = delete; - ShaderVariableVkImpl& operator= (ShaderVariableVkImpl&&) = delete; + ShaderVariableVkImpl& operator= (ShaderVariableVkImpl&&) = delete; virtual IReferenceCounters* GetReferenceCounters()const override final diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp index 5c3f53ea..5888f0b2 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp @@ -463,6 +463,10 @@ void ShaderResourceLayoutVk::VkResource::BindResource(IDeviceObject *pObj, Uint3 { VERIFY(vkDescrSet == VK_NULL_HANDLE, "Static shader resource cache should not have vulkan descriptor set allocation"); } + else + { + UNEXPECTED("Unexpected shader resource cache content type"); + } #endif auto &DstRes = DstDescrSet.GetResource(CacheOffset + ArrayIndex); VERIFY(DstRes.Type == SpirvAttribs.Type, "Inconsistent types"); @@ -657,7 +661,8 @@ const Char* ShaderResourceLayoutVk::GetShaderName()const void ShaderResourceLayoutVk::InitializeResourceMemoryInCache(ShaderResourceCacheVk& ResourceCache)const { - for(Uint32 r = 0; r < GetTotalResourceCount(); ++r) + auto TotalResources = GetTotalResourceCount(); + for(Uint32 r = 0; r < TotalResources; ++r) { const auto& Res = GetResource(r); ResourceCache.InitializeResources(Res.DescriptorSet, Res.CacheOffset, Res.SpirvAttribs.ArraySize, Res.SpirvAttribs.Type); diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp index c18ab8ae..bfcf2a4a 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp @@ -62,8 +62,10 @@ ShaderVkImpl::ShaderVkImpl(IReferenceCounters *pRefCounters, RenderDeviceVkImpl // Clone only static resources that will be set directly through the shader object std::array VarTypes = {SHADER_VARIABLE_TYPE_STATIC}; m_StaticResLayout.Initialize(m_pShaderResources, GetRawAllocator(), - VarTypes.data(), static_cast(VarTypes.size()), &m_StaticResCache, nullptr, nullptr); - m_StaticVarsMgr.Initialize(m_StaticResLayout, GetRawAllocator(), nullptr, 0, m_StaticResCache); + VarTypes.data(), static_cast(VarTypes.size()), + &m_StaticResCache, nullptr, nullptr); + m_StaticVarsMgr.Initialize(m_StaticResLayout, GetRawAllocator(), VarTypes.data(), + static_cast(VarTypes.size()), m_StaticResCache); } ShaderVkImpl::~ShaderVkImpl() -- cgit v1.2.3