From 026bc2855da39ba132dbb6dc1ab35000d2c27a30 Mon Sep 17 00:00:00 2001 From: assiduous Date: Wed, 27 Jan 2021 20:52:02 -0800 Subject: Device context Vk: added CommittedResourcesValidated to avoid calling DvpValidateCommittedShaderResources when resources have not changed --- .../GraphicsEngineVulkan/include/DeviceContextVkImpl.hpp | 4 +++- Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp | 15 +++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.hpp index 05076e10..e105a454 100644 --- a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.hpp +++ b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.hpp @@ -478,6 +478,8 @@ private: Uint32 NumCommands = 0; VkPipelineBindPoint vkPipelineBindPoint = VK_PIPELINE_BIND_POINT_MAX_ENUM; + + bool CommittedResourcesValidated = false; } m_State; // Graphics/mesh, compute, ray tracing @@ -530,7 +532,7 @@ private: void CommitDescriptorSets(DescriptorSetBindInfo& DescrSetBindInfo); #ifdef DILIGENT_DEVELOPMENT - void DvpValidateShaderResources(); + void DvpValidateCommittedShaderResources(); #endif /// Descriptor set binding information for each pipeline type (graphics/mesh, compute, ray tracing) diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index cb40cdb8..4aba7d94 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -429,8 +429,11 @@ void DeviceContextVkImpl::CommitDescriptorSets(DescriptorSetBindInfo& BindInfo) } #ifdef DILIGENT_DEVELOPMENT -void DeviceContextVkImpl::DvpValidateShaderResources() +void DeviceContextVkImpl::DvpValidateCommittedShaderResources() { + if (m_State.CommittedResourcesValidated) + return; + const auto& Layout = m_pPipelineState->GetPipelineLayout(); auto& BindInfo = GetDescriptorSetBindInfo(m_pPipelineState->GetDesc().PipelineType); const auto SignCount = Layout.GetSignatureCount(); @@ -469,6 +472,8 @@ void DeviceContextVkImpl::DvpValidateShaderResources() LayoutSign->GetDesc().Name, "' binding index (", i, ")."); } } + + m_State.CommittedResourcesValidated = true; } #endif @@ -567,6 +572,8 @@ void DeviceContextVkImpl::CommitShaderResources(IShaderResourceBinding* pShaderR BindInfo.Resources[SRBIndex] = pResBindingVkImpl; m_DynamicBufferOffsets.resize(std::max(m_DynamicBufferOffsets.size(), pSignature->GetDynamicOffsetCount())); + + m_State.CommittedResourcesValidated = false; } void DeviceContextVkImpl::SetStencilRef(Uint32 StencilRef) @@ -740,7 +747,7 @@ void DeviceContextVkImpl::PrepareForDraw(DRAW_FLAGS Flags) } #ifdef DILIGENT_DEVELOPMENT - DvpValidateShaderResources(); + DvpValidateCommittedShaderResources(); #endif } @@ -878,7 +885,7 @@ void DeviceContextVkImpl::PrepareForDispatchCompute() #endif #ifdef DILIGENT_DEVELOPMENT - DvpValidateShaderResources(); + DvpValidateCommittedShaderResources(); #endif } @@ -893,7 +900,7 @@ void DeviceContextVkImpl::PrepareForRayTracing() } #ifdef DILIGENT_DEVELOPMENT - DvpValidateShaderResources(); + DvpValidateCommittedShaderResources(); #endif } -- cgit v1.2.3