1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Fixes for OpenCLCtxScope when !m_active.

Both setEvent and the destructor should
return immediately when !m_active, as the
scope is not properly initialized (m_beginQueryId
in particular.)
This commit is contained in:
John Lynch 2021-01-22 01:16:11 -06:00
parent 20b2be3b77
commit e7b3752cab

View File

@ -261,6 +261,7 @@ namespace tracy {
tracy_force_inline void SetEvent(cl_event event) tracy_force_inline void SetEvent(cl_event event)
{ {
if (!m_active) return;
m_event = event; m_event = event;
cl_int err = clRetainEvent(m_event); cl_int err = clRetainEvent(m_event);
assert(err == CL_SUCCESS); assert(err == CL_SUCCESS);
@ -269,6 +270,7 @@ namespace tracy {
tracy_force_inline ~OpenCLCtxScope() tracy_force_inline ~OpenCLCtxScope()
{ {
if (!m_active) return;
const auto queryId = m_ctx->NextQueryId(EventInfo{ m_event, EventPhase::End }); const auto queryId = m_ctx->NextQueryId(EventInfo{ m_event, EventPhase::End });
auto item = Profiler::QueueSerial(); auto item = Profiler::QueueSerial();