diff --git a/TracyOpenGL.hpp b/TracyOpenGL.hpp index 80f00771..8306ae37 100644 --- a/TracyOpenGL.hpp +++ b/TracyOpenGL.hpp @@ -65,7 +65,6 @@ public: GLint bits; glGetQueryiv( GL_TIMESTAMP, GL_QUERY_COUNTER_BITS, &bits ); -#ifndef TRACY_ON_DEMAND const float period = 1.f; Magic magic; auto& token = s_token.ptr; @@ -78,8 +77,12 @@ public: MemWrite( &item->gpuNewContext.period, period ); MemWrite( &item->gpuNewContext.context, m_context ); MemWrite( &item->gpuNewContext.accuracyBits, (uint8_t)bits ); - tail.store( magic + 1, std::memory_order_release ); + +#ifdef TRACY_ON_DEMAND + s_profiler.DeferItem( *item ); #endif + + tail.store( magic + 1, std::memory_order_release ); } void Collect() diff --git a/TracyVulkan.hpp b/TracyVulkan.hpp index 684eb886..69740baa 100644 --- a/TracyVulkan.hpp +++ b/TracyVulkan.hpp @@ -97,7 +97,6 @@ public: vkQueueSubmit( queue, 1, &submitInfo, VK_NULL_HANDLE ); vkQueueWaitIdle( queue ); -#ifndef TRACY_ON_DEMAND Magic magic; auto& token = s_token.ptr; auto& tail = token->get_tail_index(); @@ -109,8 +108,12 @@ public: MemWrite( &item->gpuNewContext.period, period ); MemWrite( &item->gpuNewContext.context, m_context ); MemWrite( &item->gpuNewContext.accuracyBits, uint8_t( 0 ) ); - tail.store( magic + 1, std::memory_order_release ); + +#ifdef TRACY_ON_DEMAND + s_profiler.DeferItem( *item ); #endif + + tail.store( magic + 1, std::memory_order_release ); } ~VkCtx()