From de8120ed75510f7e5a98243156eced9ba96f84ca Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Thu, 24 Oct 2019 09:29:51 -0700 Subject: Vk backend: few minor updates --- Graphics/GraphicsEngineVulkan/include/PipelineLayout.h | 3 ++- Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp | 11 ++++++++--- Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineLayout.h b/Graphics/GraphicsEngineVulkan/include/PipelineLayout.h index 5198e293..1b059ce9 100644 --- a/Graphics/GraphicsEngineVulkan/include/PipelineLayout.h +++ b/Graphics/GraphicsEngineVulkan/include/PipelineLayout.h @@ -94,7 +94,7 @@ public: VkPipelineBindPoint BindPoint = VK_PIPELINE_BIND_POINT_MAX_ENUM; Uint32 SetCout = 0; Uint32 DynamicOffsetCount = 0; - bool DynamicBuffersBound = false; + bool DynamicBuffersPresent = false; bool DynamicDescriptorsBound = false; #ifdef _DEBUG const PipelineLayout* pDbgPipelineLayout = nullptr; @@ -111,6 +111,7 @@ public: BindPoint = VK_PIPELINE_BIND_POINT_MAX_ENUM; SetCout = 0; DynamicOffsetCount = 0; + DynamicBuffersPresent = false; DynamicDescriptorsBound = false; #ifdef _DEBUG diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index ebbb3dd4..6b3a5a82 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -426,7 +426,7 @@ namespace Diligent // If there are no dynamic buffers bound in the resource cache, for all subsequent // cals we do not need to bind the sets again. if (!m_DescrSetBindInfo.DynamicDescriptorsBound || - (m_DescrSetBindInfo.DynamicBuffersBound && (Flags & DRAW_FLAG_DYNAMIC_RESOURCE_BUFFERS_INTACT) == 0)) + (m_DescrSetBindInfo.DynamicBuffersPresent && (Flags & DRAW_FLAG_DYNAMIC_RESOURCE_BUFFERS_INTACT) == 0)) { m_pPipelineState->BindDescriptorSetsWithDynamicOffsets(GetCommandBuffer(), m_ContextId, this, m_DescrSetBindInfo); } @@ -544,7 +544,12 @@ namespace Diligent m_CommandBuffer.EndRenderPass(); if (m_DescrSetBindInfo.DynamicOffsetCount != 0) - m_pPipelineState->BindDescriptorSetsWithDynamicOffsets(GetCommandBuffer(), m_ContextId, this, m_DescrSetBindInfo); + { + if (!m_DescrSetBindInfo.DynamicDescriptorsBound || m_DescrSetBindInfo.DynamicBuffersPresent) + { + m_pPipelineState->BindDescriptorSetsWithDynamicOffsets(GetCommandBuffer(), m_ContextId, this, m_DescrSetBindInfo); + } + } #if 0 #ifdef _DEBUG else @@ -1198,7 +1203,7 @@ namespace Diligent VkBufferCopy CopyRegion; CopyRegion.srcOffset = SrcOffset; CopyRegion.dstOffset = DstOffset; - CopyRegion.size = NumBytes; + CopyRegion.size = NumBytes; VERIFY(pBuffVk->m_VulkanBuffer != VK_NULL_HANDLE, "Copy destination buffer must not be suballocated"); m_CommandBuffer.CopyBuffer(vkSrcBuffer, pBuffVk->GetVkBuffer(), 1, &CopyRegion); ++m_State.NumCommands; diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp index d91a860b..5179f38f 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp @@ -486,7 +486,7 @@ void PipelineLayout::PrepareDescriptorSets(DeviceContextVkImpl* pCtxVkI #ifdef _DEBUG BindInfo.pDbgPipelineLayout = this; #endif - BindInfo.DynamicBuffersBound = ResourceCache.GetNumDynamicBuffers() > 0; + BindInfo.DynamicBuffersPresent = ResourceCache.GetNumDynamicBuffers() > 0; if (TotalDynamicDescriptors == 0) { -- cgit v1.2.3