add back non-blocking collect

This commit is contained in:
Cloud Han 2022-01-25 11:54:35 +08:00
parent d660425e00
commit 21b748ac84

View File

@ -21,6 +21,7 @@
#define TracyCLZoneSetEvent(e) #define TracyCLZoneSetEvent(e)
#define TracyCLCollect(c) #define TracyCLCollect(c)
#define TracyCLBlockingCollect(c)
namespace tracy namespace tracy
{ {
@ -135,7 +136,7 @@ namespace tracy {
Profiler::QueueSerialFinish(); Profiler::QueueSerialFinish();
} }
void Collect() void Collect(bool blocking)
{ {
ZoneScopedC(Color::Red4); ZoneScopedC(Color::Red4);
@ -165,6 +166,8 @@ namespace tracy {
continue; continue;
} }
if (eventStatus != CL_COMPLETE) { if (eventStatus != CL_COMPLETE) {
if (!blocking)
return;
TRACY_CL_CHECK_ERROR(clWaitForEvents(1, &eventInfo.event)); TRACY_CL_CHECK_ERROR(clWaitForEvents(1, &eventInfo.event));
} }
@ -346,7 +349,8 @@ using TracyCLCtx = tracy::OpenCLCtx*;
#define TracyCLNamedZoneSetEvent(varname, event) varname.SetEvent(event) #define TracyCLNamedZoneSetEvent(varname, event) varname.SetEvent(event)
#define TracyCLZoneSetEvent(event) __tracy_gpu_zone.SetEvent(event) #define TracyCLZoneSetEvent(event) __tracy_gpu_zone.SetEvent(event)
#define TracyCLCollect(ctx) ctx->Collect() #define TracyCLCollect(ctx) ctx->Collect(/*blocking=*/false)
#define TracyCLBlockingCollect(ctx) ctx->Collect(/*blocking=*/true)
#endif #endif