Skip to content

Commit 7f6efe3

Browse files
authored
Merge pull request wolfpld#1065 from maxime-modulopi/vulkan-collect-host
Add support for host query reset when collecting Vulkan traces
2 parents c556831 + 656ff1b commit 7f6efe3

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

‎manual/tracy.tex‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@ \subsubsection{Vulkan}
16401640

16411641
\subparagraph{Using Vulkan 1.2 features}
16421642

1643-
Vulkan 1.2 and \texttt{VK\_EXT\_host\_query\_reset} provide mechanics to reset the query pool without the need of a command buffer. By using \texttt{TracyVkContextHostCalibrated} you can make use of this feature. It only requires a function pointer to \texttt{vkResetQueryPool} in addition to the ones required for \texttt{TracyVkContextCalibrated} instead of the VkQueue and VkCommandBuffer handles.
1643+
Vulkan 1.2 and \texttt{VK\_EXT\_host\_query\_reset} provide mechanics to reset the query pool without the need of a command buffer. By using \texttt{TracyVkContextHostCalibrated} and \texttt{TracyVkCollectHost}, you can make use of this feature. It only requires a function pointer to \texttt{vkResetQueryPool} in addition to the ones required for \texttt{TracyVkContextCalibrated} instead of the VkQueue and VkCommandBuffer handles.
16441644

16451645
However, using this feature requires the physical device to have calibrated device and host time domains. In addition to \texttt{VK\_TIME\_DOMAIN\_DEVICE\_EXT}, \texttt{vkGetPhysicalDeviceCalibrateableTimeDomainsEXT} will have to additionally return either \texttt{VK\_TIME\_DOMAIN\_CLOCK\_MONOTONIC\_RAW\_EXT} or \texttt{VK\_TIME\_DOMAIN\_QUERY\_PERFORMANCE\_COUNTER\_EXT} for Unix and Windows, respectively. If this is not the case, you will need to use \texttt{TracyVkContextCalibrated} or \texttt{TracyVkContext} macro instead.
16461646

‎public/tracy/TracyVulkan.hpp‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#define TracyVkZoneC(c,x,y,z)
1717
#define TracyVkZoneTransient(c,x,y,z,w)
1818
#define TracyVkCollect(c,x)
19+
#define TracyVkCollectHost(c)
1920

2021
#define TracyVkNamedZoneS(c,x,y,z,w,a)
2122
#define TracyVkNamedZoneCS(c,x,y,z,w,v,a)
@@ -256,7 +257,9 @@ class VkCtx
256257
#ifdef TRACY_ON_DEMAND
257258
if( !GetProfiler().IsConnected() )
258259
{
259-
VK_FUNCTION_WRAPPER( vkCmdResetQueryPool( cmdbuf, m_query, 0, m_queryCount ) );
260+
cmdbuf ?
261+
VK_FUNCTION_WRAPPER( vkCmdResetQueryPool( cmdbuf, m_query, 0, m_queryCount ) ) :
262+
VK_FUNCTION_WRAPPER( vkResetQueryPool( m_device, m_query, 0, m_queryCount ) );
260263
m_tail = head;
261264
m_oldCnt = 0;
262265
int64_t tgpu;
@@ -325,7 +328,9 @@ class VkCtx
325328
}
326329
}
327330

328-
VK_FUNCTION_WRAPPER( vkCmdResetQueryPool( cmdbuf, m_query, wrappedTail, cnt ) );
331+
cmdbuf ?
332+
VK_FUNCTION_WRAPPER( vkCmdResetQueryPool( cmdbuf, m_query, wrappedTail, cnt ) ) :
333+
VK_FUNCTION_WRAPPER( vkResetQueryPool( m_device, m_query, wrappedTail, cnt ) );
329334

330335
m_tail += cnt;
331336
}
@@ -721,6 +726,7 @@ using TracyVkCtx = tracy::VkCtx*;
721726
# define TracyVkZoneTransient( ctx, varname, cmdbuf, name, active ) tracy::VkCtxScope varname( ctx, TracyLine, TracyFile, strlen( TracyFile ), TracyFunction, strlen( TracyFunction ), name, strlen( name ), cmdbuf, active );
722727
#endif
723728
#define TracyVkCollect( ctx, cmdbuf ) ctx->Collect( cmdbuf );
729+
#define TracyVkCollectHost( ctx ) ctx->Collect( VK_NULL_HANDLE );
724730

725731
#ifdef TRACY_HAS_CALLSTACK
726732
# define TracyVkNamedZoneS( ctx, varname, cmdbuf, name, depth, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,TracyLine) { name, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; tracy::VkCtxScope varname( ctx, &TracyConcat(__tracy_gpu_source_location,TracyLine), cmdbuf, depth, active );

0 commit comments

Comments
 (0)