From e7b3752cab26819a5746ceb4cf44961a9fea90ae Mon Sep 17 00:00:00 2001 From: John Lynch Date: Fri, 22 Jan 2021 01:16:11 -0600 Subject: [PATCH] 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.) --- TracyOpenCL.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TracyOpenCL.hpp b/TracyOpenCL.hpp index 6190f802..8026d0cb 100644 --- a/TracyOpenCL.hpp +++ b/TracyOpenCL.hpp @@ -261,6 +261,7 @@ namespace tracy { tracy_force_inline void SetEvent(cl_event event) { + if (!m_active) return; m_event = event; cl_int err = clRetainEvent(m_event); assert(err == CL_SUCCESS); @@ -269,6 +270,7 @@ namespace tracy { tracy_force_inline ~OpenCLCtxScope() { + if (!m_active) return; const auto queryId = m_ctx->NextQueryId(EventInfo{ m_event, EventPhase::End }); auto item = Profiler::QueueSerial();