From 5029c12de1ff50ef9cf3b9e7c7f8563ad82bdbe4 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Fri, 5 Jun 2020 15:02:04 -0700 Subject: [PATCH] Capture Vulkan timestamps at BOTTOM_OF_PIPE instead of TOP_OF_PIPE This is so that the GPU will wait for all previous commands to finish (hit bottom of pipe) before taking the enter timestamp and then whatever was recorded within the scope to finish (hit bottom of pipe) before taking the leave timestamp. TOP_OF_PIPE (particularly at the scope exit) was just recording the time of when the recorded work within the VkCtxScope was starting (hit top of the pipe) and not waiting for it to complete. --- TracyVulkan.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TracyVulkan.hpp b/TracyVulkan.hpp index 4482f987..7f6b9182 100644 --- a/TracyVulkan.hpp +++ b/TracyVulkan.hpp @@ -210,7 +210,7 @@ public: m_ctx = ctx; const auto queryId = ctx->NextQueryId(); - vkCmdWriteTimestamp( cmdbuf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, ctx->m_query, queryId ); + vkCmdWriteTimestamp( cmdbuf, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, ctx->m_query, queryId ); auto item = Profiler::QueueSerial(); MemWrite( &item->hdr.type, QueueType::GpuZoneBeginSerial ); @@ -234,7 +234,7 @@ public: m_ctx = ctx; const auto queryId = ctx->NextQueryId(); - vkCmdWriteTimestamp( cmdbuf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, ctx->m_query, queryId ); + vkCmdWriteTimestamp( cmdbuf, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, ctx->m_query, queryId ); auto item = Profiler::QueueSerial(); MemWrite( &item->hdr.type, QueueType::GpuZoneBeginCallstackSerial ); @@ -253,7 +253,7 @@ public: if( !m_active ) return; const auto queryId = m_ctx->NextQueryId(); - vkCmdWriteTimestamp( m_cmdbuf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, m_ctx->m_query, queryId ); + vkCmdWriteTimestamp( m_cmdbuf, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, m_ctx->m_query, queryId ); auto item = Profiler::QueueSerial(); MemWrite( &item->hdr.type, QueueType::GpuZoneEndSerial );