summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-01-11 04:48:02 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-01-11 04:48:02 +0000
commit3dddd004d3622b7e0d7bad5dea52d622657585e5 (patch)
tree75ec9e818f0012087eb174d8c3a4adae804bf9ff /Graphics/GraphicsEngineVulkan
parentappveyor: defining CMAKE_INSTALL_PREFIX in the command line (diff)
downloadDiligentCore-3dddd004d3622b7e0d7bad5dea52d622657585e5.tar.gz
DiligentCore-3dddd004d3622b7e0d7bad5dea52d622657585e5.zip
Fixed few issues with queries
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanCommandBuffer.h4
-rw-r--r--Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/QueryManagerVk.cpp5
-rw-r--r--Graphics/GraphicsEngineVulkan/src/QueryVkImpl.cpp10
4 files changed, 14 insertions, 7 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanCommandBuffer.h b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanCommandBuffer.h
index ef454910..786a2059 100644
--- a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanCommandBuffer.h
+++ b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanCommandBuffer.h
@@ -201,8 +201,8 @@ public:
m_State.FramebufferHeight = 0;
if (m_State.InsidePassQueries != 0)
{
- LOG_ERROR_MESSAGE("There are outstanding queries that have been started inside the render pass, but have "
- "not been ended. Vulkan requires that a query must either begin and end inside the same "
+ LOG_ERROR_MESSAGE("Ending render pass while there are outstanding queries that have been started inside the pass, "
+ "but have not been ended. Vulkan requires that a query must either begin and end inside the same "
"subpass of a render pass instance, or must both begin and end outside of a render pass "
"instance (i.e. contain entire render pass instances). (17.2)");
}
diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
index 5af8012f..e8b254a8 100644
--- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
@@ -1186,6 +1186,8 @@ void DeviceContextVkImpl::ResetRenderTargets()
TDeviceContextBase::ResetRenderTargets();
m_RenderPass = VK_NULL_HANDLE;
m_Framebuffer = VK_NULL_HANDLE;
+ if (m_CommandBuffer.GetVkCmdBuffer() != VK_NULL_HANDLE && m_CommandBuffer.GetState().RenderPass != VK_NULL_HANDLE)
+ m_CommandBuffer.EndRenderPass();
}
void DeviceContextVkImpl::UpdateBufferRegion(BufferVkImpl* pBuffVk,
diff --git a/Graphics/GraphicsEngineVulkan/src/QueryManagerVk.cpp b/Graphics/GraphicsEngineVulkan/src/QueryManagerVk.cpp
index 44b84e78..548c497b 100644
--- a/Graphics/GraphicsEngineVulkan/src/QueryManagerVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/QueryManagerVk.cpp
@@ -136,9 +136,10 @@ QueryManagerVk::~QueryManagerVk()
for (Uint32 QueryType = QUERY_TYPE_UNDEFINED + 1; QueryType < QUERY_TYPE_NUM_TYPES; ++QueryType)
{
auto& HeapInfo = m_Heaps[QueryType];
- if (HeapInfo.AvailableQueries.size() != HeapInfo.PoolSize)
+
+ auto OutstandingQueries = HeapInfo.PoolSize - (HeapInfo.AvailableQueries.size() + HeapInfo.StaleQueries.size());
+ if (OutstandingQueries != 0)
{
- auto OutstandingQueries = HeapInfo.PoolSize - HeapInfo.AvailableQueries.size();
if (OutstandingQueries == 1)
{
LOG_ERROR_MESSAGE("One query of type ", GetQueryTypeString(static_cast<QUERY_TYPE>(QueryType)),
diff --git a/Graphics/GraphicsEngineVulkan/src/QueryVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/QueryVkImpl.cpp
index 3eb95eba..abd1567e 100644
--- a/Graphics/GraphicsEngineVulkan/src/QueryVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/QueryVkImpl.cpp
@@ -53,9 +53,13 @@ QueryVkImpl::QueryVkImpl(IReferenceCounters* pRefCounters,
QueryVkImpl::~QueryVkImpl()
{
- auto* pQueryMgr = m_pContext.RawPtr<DeviceContextVkImpl>()->GetQueryManager();
- VERIFY_EXPR(pQueryMgr != nullptr);
- pQueryMgr->DiscardQuery(m_Desc.Type, m_QueryPoolIndex);
+ if (m_QueryPoolIndex != QueryManagerVk::InvalidIndex)
+ {
+ VERIFY(m_pContext != nullptr, "Device context is not initialized");
+ auto* pQueryMgr = m_pContext.RawPtr<DeviceContextVkImpl>()->GetQueryManager();
+ VERIFY_EXPR(pQueryMgr != nullptr);
+ pQueryMgr->DiscardQuery(m_Desc.Type, m_QueryPoolIndex);
+ }
}
bool QueryVkImpl::AllocateQuery()