GPU context counter is now 8 bit.

This commit is contained in:
Bartosz Taudul 2018-06-22 15:10:23 +02:00
parent d13fc2413f
commit 55ddb64352
5 changed files with 19 additions and 13 deletions

View File

@ -15,6 +15,7 @@
#else #else
#include <atomic> #include <atomic>
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include "Tracy.hpp" #include "Tracy.hpp"
@ -39,7 +40,7 @@
namespace tracy namespace tracy
{ {
extern std::atomic<uint16_t> s_gpuCtxCounter; extern std::atomic<uint8_t> s_gpuCtxCounter;
class GpuCtx class GpuCtx
{ {
@ -53,6 +54,8 @@ public:
, m_head( 0 ) , m_head( 0 )
, m_tail( 0 ) , m_tail( 0 )
{ {
assert( m_context != 255 );
glGenQueries( QueryCount, m_query ); glGenQueries( QueryCount, m_query );
int64_t tgpu; int64_t tgpu;
@ -142,13 +145,13 @@ private:
return m_query[id]; return m_query[id];
} }
tracy_force_inline uint16_t GetId() const tracy_force_inline uint8_t GetId() const
{ {
return m_context; return m_context;
} }
unsigned int m_query[QueryCount]; unsigned int m_query[QueryCount];
uint16_t m_context; uint8_t m_context;
unsigned int m_head; unsigned int m_head;
unsigned int m_tail; unsigned int m_tail;

View File

@ -13,6 +13,7 @@
#else #else
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>
#include "Tracy.hpp" #include "Tracy.hpp"
@ -36,7 +37,7 @@
namespace tracy namespace tracy
{ {
extern std::atomic<uint16_t> s_gpuCtxCounter; extern std::atomic<uint8_t> s_gpuCtxCounter;
class VkCtx class VkCtx
{ {
@ -53,6 +54,8 @@ public:
, m_tail( 0 ) , m_tail( 0 )
, m_oldCnt( 0 ) , m_oldCnt( 0 )
{ {
assert( m_context != 255 );
VkPhysicalDeviceProperties prop; VkPhysicalDeviceProperties prop;
vkGetPhysicalDeviceProperties( physdev, &prop ); vkGetPhysicalDeviceProperties( physdev, &prop );
const float period = prop.limits.timestampPeriod; const float period = prop.limits.timestampPeriod;
@ -167,7 +170,7 @@ private:
return id; return id;
} }
tracy_force_inline uint16_t GetId() const tracy_force_inline uint8_t GetId() const
{ {
return m_context; return m_context;
} }
@ -175,7 +178,7 @@ private:
VkDevice m_device; VkDevice m_device;
VkQueue m_queue; VkQueue m_queue;
VkQueryPool m_query; VkQueryPool m_query;
uint16_t m_context; uint8_t m_context;
unsigned int m_head; unsigned int m_head;
unsigned int m_tail; unsigned int m_tail;

View File

@ -169,7 +169,7 @@ static InitTimeWrapper init_order(101) s_initTime { SetupHwTimer() };
static RPMallocInit init_order(102) s_rpmalloc_init; static RPMallocInit init_order(102) s_rpmalloc_init;
moodycamel::ConcurrentQueue<QueueItem> init_order(103) s_queue( QueuePrealloc ); moodycamel::ConcurrentQueue<QueueItem> init_order(103) s_queue( QueuePrealloc );
std::atomic<uint32_t> init_order(104) s_lockCounter( 0 ); std::atomic<uint32_t> init_order(104) s_lockCounter( 0 );
std::atomic<uint16_t> init_order(104) s_gpuCtxCounter( 0 ); std::atomic<uint8_t> init_order(104) s_gpuCtxCounter( 0 );
thread_local GpuCtxWrapper init_order(104) s_gpuCtx { nullptr }; thread_local GpuCtxWrapper init_order(104) s_gpuCtx { nullptr };
VkCtxWrapper init_order(104) s_vkCtx { nullptr }; VkCtxWrapper init_order(104) s_vkCtx { nullptr };

View File

@ -168,7 +168,7 @@ struct QueueGpuNewContext
int64_t gpuTime; int64_t gpuTime;
uint64_t thread; uint64_t thread;
float period; float period;
uint16_t context; uint8_t context;
uint8_t accuracyBits; uint8_t accuracyBits;
}; };
@ -177,26 +177,26 @@ struct QueueGpuZoneBegin
int64_t cpuTime; int64_t cpuTime;
uint64_t srcloc; uint64_t srcloc;
uint64_t thread; uint64_t thread;
uint16_t context; uint8_t context;
}; };
struct QueueGpuZoneEnd struct QueueGpuZoneEnd
{ {
int64_t cpuTime; int64_t cpuTime;
uint16_t context; uint8_t context;
}; };
struct QueueGpuTime struct QueueGpuTime
{ {
int64_t gpuTime; int64_t gpuTime;
uint16_t context; uint8_t context;
}; };
struct QueueGpuResync struct QueueGpuResync
{ {
int64_t cpuTime; int64_t cpuTime;
int64_t gpuTime; int64_t gpuTime;
uint16_t context; uint8_t context;
}; };
struct QueueMemAlloc struct QueueMemAlloc

View File

@ -322,7 +322,7 @@ private:
char* m_buffer; char* m_buffer;
int m_bufferOffset; int m_bufferOffset;
flat_hash_map<uint16_t, GpuCtxData*, nohash<uint16_t>> m_gpuCtxMap; flat_hash_map<uint8_t, GpuCtxData*, nohash<uint8_t>> m_gpuCtxMap;
flat_hash_map<uint64_t, StringLocation, nohash<uint64_t>> m_pendingCustomStrings; flat_hash_map<uint64_t, StringLocation, nohash<uint64_t>> m_pendingCustomStrings;
flat_hash_map<uint64_t, PlotData*, nohash<uint64_t>> m_pendingPlots; flat_hash_map<uint64_t, PlotData*, nohash<uint64_t>> m_pendingPlots;
flat_hash_map<uint64_t, uint32_t> m_pendingCallstacks; flat_hash_map<uint64_t, uint32_t> m_pendingCallstacks;