Skip to content

Commit 722c01d

Browse files
committed
Better match TracyOpenGL.hpp impl
1 parent 151c969 commit 722c01d

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

include/render/fx_renderer/fx_renderer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ struct fx_renderer {
170170
PFNGLDELETEQUERIESEXTPROC glDeleteQueriesEXT;
171171
PFNGLQUERYCOUNTEREXTPROC glQueryCounterEXT;
172172
PFNGLGETQUERYOBJECTIVEXTPROC glGetQueryObjectivEXT;
173+
PFNGLGETQUERYIVEXTPROC glGetQueryivEXT;
173174
PFNGLGETQUERYOBJECTUI64VEXTPROC glGetQueryObjectui64vEXT;
174175
PFNGLGETINTEGER64VEXTPROC glGetInteger64vEXT;
175176
} procs;

render/fx_renderer/fx_renderer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ struct wlr_renderer *fx_renderer_create_egl(struct wlr_egl *egl) {
486486
load_gl_proc(&renderer->procs.glDeleteQueriesEXT, "glDeleteQueriesEXT");
487487
load_gl_proc(&renderer->procs.glQueryCounterEXT, "glQueryCounterEXT");
488488
load_gl_proc(&renderer->procs.glGetQueryObjectivEXT, "glGetQueryObjectivEXT");
489+
load_gl_proc(&renderer->procs.glGetQueryivEXT, "glGetQueryivEXT");
489490
load_gl_proc(&renderer->procs.glGetQueryObjectui64vEXT, "glGetQueryObjectui64vEXT");
490491
if (eglGetProcAddress("glGetInteger64vEXT")) {
491492
load_gl_proc(&renderer->procs.glGetInteger64vEXT, "glGetInteger64vEXT");

render/fx_renderer/tracy.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ void tracy_gpu_zone_begin(struct tracy_data *tracy_data, struct tracy_gpu_zone_c
5858
}
5959

6060
// Create the query object
61-
unsigned int query = tracy_data->queries[get_next_query_index(tracy_data)];
62-
tracy_data->renderer->procs.glQueryCounterEXT(query, GL_TIMESTAMP_EXT);
61+
const unsigned int query = get_next_query_index(tracy_data);
62+
tracy_data->renderer->procs.glQueryCounterEXT(tracy_data->queries[query], GL_TIMESTAMP_EXT);
6363

6464
// Label the zone
6565
uint64_t srcloc = ___tracy_alloc_srcloc_name(line,
@@ -84,9 +84,8 @@ void tracy_gpu_zone_end(struct tracy_gpu_zone_context *ctx) {
8484
struct tracy_data *tracy_data = ctx->tracy_data;
8585

8686
// Create the query object
87-
unsigned int query = tracy_data->queries[get_next_query_index(tracy_data)];
88-
tracy_data->renderer->procs.glQueryCounterEXT(
89-
query, GL_TIMESTAMP_EXT);
87+
const unsigned int query = get_next_query_index(tracy_data);
88+
tracy_data->renderer->procs.glQueryCounterEXT(tracy_data->queries[query], GL_TIMESTAMP_EXT);
9089

9190
// End the Tracy GPU zone
9291
const struct ___tracy_gpu_zone_end_data data = {
@@ -98,6 +97,7 @@ void tracy_gpu_zone_end(struct tracy_gpu_zone_context *ctx) {
9897

9998
void tracy_gpu_context_collect(struct tracy_data *tracy_data) {
10099
if (tracy_data == NULL) {
100+
TracyCMessageL("tracy_data == NULL");
101101
return;
102102
}
103103

@@ -132,7 +132,7 @@ void tracy_gpu_context_collect(struct tracy_data *tracy_data) {
132132
const struct ___tracy_gpu_time_data data = {
133133
.context = tracy_data->context_id,
134134
.gpuTime = time,
135-
.queryId = (uint16_t) tracy_data->queries[tracy_data->q_tail],
135+
.queryId = (uint16_t) tracy_data->q_tail,
136136
};
137137
___tracy_emit_gpu_time(data);
138138

@@ -167,17 +167,17 @@ struct tracy_data *tracy_gpu_context_new(struct fx_renderer *renderer) {
167167
tracy_data->q_head = 0;
168168
tracy_data->q_tail = 0;
169169

170-
// clear disjoint flag
171-
GLint64 disjoint;
172-
renderer->procs.glGetInteger64vEXT(GL_GPU_DISJOINT_EXT, &disjoint);
173-
174170
// Create the query objects
175171
renderer->procs.glGenQueriesEXT(QUERY_COUNT, tracy_data->queries);
176172

177173
// Get the current GL time
178174
GLint64 gl_gpu_time;
179175
renderer->procs.glGetInteger64vEXT(GL_TIMESTAMP_EXT, &gl_gpu_time);
180176

177+
// Create the query objects
178+
GLint bits;
179+
renderer->procs.glGetQueryivEXT(GL_TIMESTAMP_EXT, GL_QUERY_COUNTER_BITS_EXT, &bits);
180+
181181
const struct ___tracy_gpu_new_context_data data = {
182182
.context = tracy_data->context_id,
183183
.gpuTime = gl_gpu_time,

0 commit comments

Comments
 (0)