Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Taudul <wolf.pld@gmail.com>2021-01-31 20:47:05 +0300
committerBartosz Taudul <wolf.pld@gmail.com>2021-01-31 21:15:23 +0300
commitcd4114f264d55c683e79693362f238f607ce740a (patch)
tree529417933a2dcebf75f9f3134c3c6ed9aaabcc72 /TracyOpenCL.hpp
parent7f5810dfd625adad8ad86859b65ea56efed03884 (diff)
Add GPU name transfer macros.
Diffstat (limited to 'TracyOpenCL.hpp')
-rw-r--r--TracyOpenCL.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/TracyOpenCL.hpp b/TracyOpenCL.hpp
index 6197ddda..393ada9a 100644
--- a/TracyOpenCL.hpp
+++ b/TracyOpenCL.hpp
@@ -5,6 +5,7 @@
#define TracyCLContext(c, x) nullptr
#define TracyCLDestroy(c)
+#define TracyCLContextName(c, x, y)
#define TracyCLNamedZone(c, x, y, z)
#define TracyCLNamedZoneC(c, x, y, z, w)
@@ -109,6 +110,22 @@ namespace tracy {
Profiler::QueueSerialFinish();
}
+ void Name( const char* name, uint16_t len )
+ {
+ auto ptr = (char*)tracy_malloc( len );
+ memcpy( ptr, name, len );
+
+ auto item = Profiler::QueueSerial();
+ MemWrite( &item->hdr.type, QueueType::GpuContextName );
+ MemWrite( &item->gpuContextNameFat.context, (uint8_t)m_contextId );
+ MemWrite( &item->gpuContextNameFat.ptr, (uint64_t)ptr );
+ MemWrite( &item->gpuContextNameFat.size, len );
+#ifdef TRACY_ON_DEMAND
+ GetProfiler().DeferItem( *item );
+#endif
+ Profiler::QueueSerialFinish();
+ }
+
void Collect()
{
ZoneScopedC(Color::Red4);
@@ -287,6 +304,7 @@ using TracyCLCtx = tracy::OpenCLCtx*;
#define TracyCLContext(context, device) tracy::CreateCLContext(context, device);
#define TracyCLDestroy(ctx) tracy::DestroyCLContext(ctx);
+#define TracyCLContextName(context, name, size) ctx->Name(name, size);
#if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK
# define TracyCLNamedZone(ctx, varname, name, active) static constexpr tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::OpenCLCtxScope varname(ctx, &TracyConcat(__tracy_gpu_source_location,__LINE__), TRACY_CALLSTACK, active );
# define TracyCLNamedZoneC(ctx, varname, name, color, active) static constexpr tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::OpenCLCtxScope varname(ctx, &TracyConcat(__tracy_gpu_source_location,__LINE__), TRACY_CALLSTACK, active );