10 #include "../deps/tracy/public/tracy/TracyC.h"
162 TracyCZoneCtx tracy_ctx;
172 TracyCZoneEnd(stage_raii->tracy_ctx);
181 #define GPU_STAGE_PROFILER(profiler_ptr, name, color) \
182 TracyCZoneN(_tracy_ctx##__LINE__, name, 1); \
183 void* _tracy_gpu_ctx##__LINE__ = \
184 tracy_gpu_zone_begin(name, __func__, __FILE__, __LINE__, color); \
185 GPUStageRAII _stage_raii##__LINE__ \
186 __attribute__((cleanup(gpu_stage_cleanup_raii))) \
187 __attribute__((unused)) = {profiler_ptr, _tracy_ctx##__LINE__, \
188 _tracy_gpu_ctx##__LINE__}; \
189 gpu_profiler_start_stage(profiler_ptr, name, color)
191 #define GPU_STAGE_PROFILER(profiler_ptr, name, color) \
192 GPUStageRAII _stage_raii##__LINE__ \
193 __attribute__((cleanup(gpu_stage_cleanup_raii))) \
194 __attribute__((unused)) = {profiler_ptr}; \
195 gpu_profiler_start_stage(profiler_ptr, name, color)
Adaptive sampling utility for performance metrics.
Global application constants, configuration macros, and default values.
static const int GPU_PROFILER_ENV_COLOR
Definition: gpu_profiler.h:22
void gpu_profiler_begin_frame(GPUProfiler *profiler, uint64_t frame_index)
Marks the beginning of a frame. Swaps buffers and processes previous results.
Definition: gpu_profiler.c:98
static const int GPU_PROFILER_MOTION_BLUR_COLOR
Definition: gpu_profiler.h:27
static const int GPU_PROFILER_UI_COLOR
Definition: gpu_profiler.h:30
static const float GPU_PROFILER_ROW_HEIGHT
Definition: gpu_profiler.h:37
void gpu_profiler_set_enabled(GPUProfiler *profiler, bool enabled)
Enables or disables the profiler.
Definition: gpu_profiler.c:91
static const int GPU_PROFILER_GI_SYNC_COLOR
Definition: gpu_profiler.h:31
static const int GPU_PROFILER_SCENE_COLOR
Definition: gpu_profiler.h:23
static const int GPU_PROFILER_GI_DEBUG_COLOR
Definition: gpu_profiler.h:32
static const int GPU_PROFILER_BLOOM_COLOR
Definition: gpu_profiler.h:25
static const float GPU_PROFILER_WINDOW_TRANSITION_S
Definition: gpu_profiler.h:36
void gpu_profiler_init(GPUProfiler *profiler)
Initializes the GPU profiler.
Definition: gpu_profiler.c:19
void gpu_profiler_cleanup(GPUProfiler *profiler)
Cleans up GPU resources.
Definition: gpu_profiler.c:63
static const float GPU_PROFILER_WINDOW_DURATION_S
Definition: gpu_profiler.h:35
void gpu_profiler_start_stage(GPUProfiler *profiler, const char *name, uint32_t color)
Starts a new profiling stage.
Definition: gpu_profiler.c:203
static void gpu_stage_cleanup_raii(GPUStageRAII *stage_raii)
Internal cleanup function for GPUStageRAII.
Definition: gpu_profiler.h:168
@ GPU_QUERY_BUFFER_COUNT
Definition: gpu_profiler.h:17
@ MAX_GPU_STAGE_NAME
Definition: gpu_profiler.h:16
@ MAX_GPU_STAGES
Definition: gpu_profiler.h:15
static const int GPU_PROFILER_TOTAL_FRAME_COLOR
Definition: gpu_profiler.h:21
void gpu_profiler_reset_samplers(GPUProfiler *profiler, double current_time)
Resets all samplers for a new capture window.
Definition: gpu_profiler.c:252
static const int GPU_PROFILER_POSTPROCESS_COLOR
Definition: gpu_profiler.h:29
static const int GPU_PROFILER_DOF_COLOR
Definition: gpu_profiler.h:26
void gpu_profiler_end_stage(GPUProfiler *profiler)
Ends the current profiling stage.
Definition: gpu_profiler.c:236
static const int GPU_PROFILER_COMPOSITE_COLOR
Definition: gpu_profiler.h:28
static const int GPU_PROFILER_AUTO_EXPOSURE_COLOR
Definition: gpu_profiler.h:24
High-precision performance measurement (CPU and GPU).
Collector for performance samples within a rolling or fixed window.
Definition: adaptive_sampler.h:38
Manages GPU timing using double-buffered queries to avoid stalls.
Definition: gpu_profiler.h:86
int stage_count
Definition: gpu_profiler.h:88
int read_index
Definition: gpu_profiler.h:98
float transition_progress
Definition: gpu_profiler.h:104
int current_stage_index
Definition: gpu_profiler.h:101
bool enabled
Definition: gpu_profiler.h:105
int write_index
Definition: gpu_profiler.h:96
int recording_count
Definition: gpu_profiler.h:91
MetricStack hierarchy_stack
Definition: gpu_profiler.h:102
Set of GL queries for one frame, with stage metadata.
Definition: gpu_profiler.h:75
int stage_count
Definition: gpu_profiler.h:78
uint64_t frame_index
Definition: gpu_profiler.h:79
Per-frame stage metadata stored alongside queries.
Definition: gpu_profiler.h:64
int depth
Definition: gpu_profiler.h:67
uint32_t color
Definition: gpu_profiler.h:66
int parent_index
Definition: gpu_profiler.h:68
RAII container for automatic GPU stage management and Tracy zones.
Definition: gpu_profiler.h:159
GPUProfiler * profiler
Definition: gpu_profiler.h:160
Represents a single profiling stage (e.g., "Shadow Map", "G-Buffer").
Definition: gpu_profiler.h:45
int parent_index
Definition: gpu_profiler.h:57
float prev_start_offset_ms
Definition: gpu_profiler.h:52
float duration_ms
Definition: gpu_profiler.h:51
int depth
Definition: gpu_profiler.h:56
AdaptiveSampler duration_sampler
Definition: gpu_profiler.h:48
float start_offset_ms
Definition: gpu_profiler.h:50
uint32_t color
Definition: gpu_profiler.h:47
AdaptiveSampler offset_sampler
Definition: gpu_profiler.h:49
float prev_alpha
Definition: gpu_profiler.h:55
float prev_duration_ms
Definition: gpu_profiler.h:53
float alpha
Definition: gpu_profiler.h:54
GPU performance timer using OpenGL Query Objects.
Definition: perf_timer.h:34
Definition: metric_stack.h:8
#define tracy_gpu_zone_end(ctx)
Definition: tracy_gpu.h:36