1 /*
2 * Copyright © 2020 Valve Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24 #include "radv_private.h"
25
26 /**
27 * Identifiers for RGP SQ thread-tracing markers (Table 1)
28 */
29 enum rgp_sqtt_marker_identifier {
30 RGP_SQTT_MARKER_IDENTIFIER_EVENT = 0x0,
31 RGP_SQTT_MARKER_IDENTIFIER_CB_START = 0x1,
32 RGP_SQTT_MARKER_IDENTIFIER_CB_END = 0x2,
33 RGP_SQTT_MARKER_IDENTIFIER_BARRIER_START = 0x3,
34 RGP_SQTT_MARKER_IDENTIFIER_BARRIER_END = 0x4,
35 RGP_SQTT_MARKER_IDENTIFIER_USER_EVENT = 0x5,
36 RGP_SQTT_MARKER_IDENTIFIER_GENERAL_API = 0x6,
37 RGP_SQTT_MARKER_IDENTIFIER_SYNC = 0x7,
38 RGP_SQTT_MARKER_IDENTIFIER_PRESENT = 0x8,
39 RGP_SQTT_MARKER_IDENTIFIER_LAYOUT_TRANSITION = 0x9,
40 RGP_SQTT_MARKER_IDENTIFIER_RENDER_PASS = 0xA,
41 RGP_SQTT_MARKER_IDENTIFIER_RESERVED2 = 0xB,
42 RGP_SQTT_MARKER_IDENTIFIER_BIND_PIPELINE = 0xC,
43 RGP_SQTT_MARKER_IDENTIFIER_RESERVED4 = 0xD,
44 RGP_SQTT_MARKER_IDENTIFIER_RESERVED5 = 0xE,
45 RGP_SQTT_MARKER_IDENTIFIER_RESERVED6 = 0xF
46 };
47
48 /**
49 * RGP SQ thread-tracing marker for the start of a command buffer. (Table 2)
50 */
51 struct rgp_sqtt_marker_cb_start {
52 union {
53 struct {
54 uint32_t identifier : 4;
55 uint32_t ext_dwords : 3;
56 uint32_t cb_id : 20;
57 uint32_t queue : 5;
58 };
59 uint32_t dword01;
60 };
61 union {
62 uint32_t device_id_low;
63 uint32_t dword02;
64 };
65 union {
66 uint32_t device_id_high;
67 uint32_t dword03;
68 };
69 union {
70 uint32_t queue_flags;
71 uint32_t dword04;
72 };
73 };
74
75 static_assert(sizeof(struct rgp_sqtt_marker_cb_start) == 16,
76 "rgp_sqtt_marker_cb_start doesn't match RGP spec");
77
78 /**
79 *
80 * RGP SQ thread-tracing marker for the end of a command buffer. (Table 3)
81 */
82 struct rgp_sqtt_marker_cb_end {
83 union {
84 struct {
85 uint32_t identifier : 4;
86 uint32_t ext_dwords : 3;
87 uint32_t cb_id : 20;
88 uint32_t reserved : 5;
89 };
90 uint32_t dword01;
91 };
92 union {
93 uint32_t device_id_low;
94 uint32_t dword02;
95 };
96 union {
97 uint32_t device_id_high;
98 uint32_t dword03;
99 };
100 };
101
102 static_assert(sizeof(struct rgp_sqtt_marker_cb_end) == 12,
103 "rgp_sqtt_marker_cb_end doesn't match RGP spec");
104
105 /**
106 * API types used in RGP SQ thread-tracing markers for the "General API"
107 * packet.
108 */
109 enum rgp_sqtt_marker_general_api_type {
110 ApiCmdBindPipeline = 0,
111 ApiCmdBindDescriptorSets = 1,
112 ApiCmdBindIndexBuffer = 2,
113 ApiCmdBindVertexBuffers = 3,
114 ApiCmdDraw = 4,
115 ApiCmdDrawIndexed = 5,
116 ApiCmdDrawIndirect = 6,
117 ApiCmdDrawIndexedIndirect = 7,
118 ApiCmdDrawIndirectCountAMD = 8,
119 ApiCmdDrawIndexedIndirectCountAMD = 9,
120 ApiCmdDispatch = 10,
121 ApiCmdDispatchIndirect = 11,
122 ApiCmdCopyBuffer = 12,
123 ApiCmdCopyImage = 13,
124 ApiCmdBlitImage = 14,
125 ApiCmdCopyBufferToImage = 15,
126 ApiCmdCopyImageToBuffer = 16,
127 ApiCmdUpdateBuffer = 17,
128 ApiCmdFillBuffer = 18,
129 ApiCmdClearColorImage = 19,
130 ApiCmdClearDepthStencilImage = 20,
131 ApiCmdClearAttachments = 21,
132 ApiCmdResolveImage = 22,
133 ApiCmdWaitEvents = 23,
134 ApiCmdPipelineBarrier = 24,
135 ApiCmdBeginQuery = 25,
136 ApiCmdEndQuery = 26,
137 ApiCmdResetQueryPool = 27,
138 ApiCmdWriteTimestamp = 28,
139 ApiCmdCopyQueryPoolResults = 29,
140 ApiCmdPushConstants = 30,
141 ApiCmdBeginRenderPass = 31,
142 ApiCmdNextSubpass = 32,
143 ApiCmdEndRenderPass = 33,
144 ApiCmdExecuteCommands = 34,
145 ApiCmdSetViewport = 35,
146 ApiCmdSetScissor = 36,
147 ApiCmdSetLineWidth = 37,
148 ApiCmdSetDepthBias = 38,
149 ApiCmdSetBlendConstants = 39,
150 ApiCmdSetDepthBounds = 40,
151 ApiCmdSetStencilCompareMask = 41,
152 ApiCmdSetStencilWriteMask = 42,
153 ApiCmdSetStencilReference = 43,
154 ApiCmdDrawIndirectCount = 44,
155 ApiCmdDrawIndexedIndirectCount = 45,
156 ApiInvalid = 0xffffffff
157 };
158
159 /**
160 * RGP SQ thread-tracing marker for a "General API" instrumentation packet.
161 */
162 struct rgp_sqtt_marker_general_api {
163 union {
164 struct {
165 uint32_t identifier : 4;
166 uint32_t ext_dwords : 3;
167 uint32_t api_type : 20;
168 uint32_t is_end : 1;
169 uint32_t reserved : 4;
170 };
171 uint32_t dword01;
172 };
173 };
174
175 static_assert(sizeof(struct rgp_sqtt_marker_general_api) == 4,
176 "rgp_sqtt_marker_general_api doesn't match RGP spec");
177
178 /**
179 * API types used in RGP SQ thread-tracing markers (Table 16).
180 */
181 enum rgp_sqtt_marker_event_type {
182 EventCmdDraw = 0,
183 EventCmdDrawIndexed = 1,
184 EventCmdDrawIndirect = 2,
185 EventCmdDrawIndexedIndirect = 3,
186 EventCmdDrawIndirectCountAMD = 4,
187 EventCmdDrawIndexedIndirectCountAMD = 5,
188 EventCmdDispatch = 6,
189 EventCmdDispatchIndirect = 7,
190 EventCmdCopyBuffer = 8,
191 EventCmdCopyImage = 9,
192 EventCmdBlitImage = 10,
193 EventCmdCopyBufferToImage = 11,
194 EventCmdCopyImageToBuffer = 12,
195 EventCmdUpdateBuffer = 13,
196 EventCmdFillBuffer = 14,
197 EventCmdClearColorImage = 15,
198 EventCmdClearDepthStencilImage = 16,
199 EventCmdClearAttachments = 17,
200 EventCmdResolveImage = 18,
201 EventCmdWaitEvents = 19,
202 EventCmdPipelineBarrier = 20,
203 EventCmdResetQueryPool = 21,
204 EventCmdCopyQueryPoolResults = 22,
205 EventRenderPassColorClear = 23,
206 EventRenderPassDepthStencilClear = 24,
207 EventRenderPassResolve = 25,
208 EventInternalUnknown = 26,
209 EventCmdDrawIndirectCount = 27,
210 EventCmdDrawIndexedIndirectCount = 28,
211 EventInvalid = 0xffffffff
212 };
213
214 /**
215 * "Event (Per-draw/dispatch)" RGP SQ thread-tracing marker. (Table 4)
216 */
217 struct rgp_sqtt_marker_event {
218 union {
219 struct {
220 uint32_t identifier : 4;
221 uint32_t ext_dwords : 3;
222 uint32_t api_type : 24;
223 uint32_t has_thread_dims : 1;
224 };
225 uint32_t dword01;
226 };
227 union {
228 struct {
229 uint32_t cb_id : 20;
230 uint32_t vertex_offset_reg_idx : 4;
231 uint32_t instance_offset_reg_idx : 4;
232 uint32_t draw_index_reg_idx : 4;
233 };
234 uint32_t dword02;
235 };
236 union {
237 uint32_t cmd_id;
238 uint32_t dword03;
239 };
240 };
241
242 static_assert(sizeof(struct rgp_sqtt_marker_event) == 12,
243 "rgp_sqtt_marker_event doesn't match RGP spec");
244
245 /**
246 * Per-dispatch specific marker where workgroup dims are included.
247 */
248 struct rgp_sqtt_marker_event_with_dims {
249 struct rgp_sqtt_marker_event event;
250 uint32_t thread_x;
251 uint32_t thread_y;
252 uint32_t thread_z;
253 };
254
255 static_assert(sizeof(struct rgp_sqtt_marker_event_with_dims) == 24,
256 "rgp_sqtt_marker_event_with_dims doesn't match RGP spec");
257
258 /**
259 * "Barrier Start" RGP SQTT instrumentation marker (Table 5)
260 */
261 struct rgp_sqtt_marker_barrier_start {
262 union {
263 struct {
264 uint32_t identifier : 4;
265 uint32_t ext_dwords : 3;
266 uint32_t cb_id : 20;
267 uint32_t reserved : 5;
268 };
269 uint32_t dword01;
270 };
271 union {
272 struct {
273 uint32_t driver_reason : 31;
274 uint32_t internal : 1;
275 };
276 uint32_t dword02;
277 };
278 };
279
280 static_assert(sizeof(struct rgp_sqtt_marker_barrier_start) == 8,
281 "rgp_sqtt_marker_barrier_start doesn't match RGP spec");
282
283 /**
284 * "Barrier End" RGP SQTT instrumentation marker (Table 6)
285 */
286 struct rgp_sqtt_marker_barrier_end {
287 union {
288 struct {
289 uint32_t identifier : 4;
290 uint32_t ext_dwords : 3;
291 uint32_t cb_id : 20;
292 uint32_t wait_on_eop_ts : 1;
293 uint32_t vs_partial_flush : 1;
294 uint32_t ps_partial_flush : 1;
295 uint32_t cs_partial_flush : 1;
296 uint32_t pfp_sync_me : 1;
297 };
298 uint32_t dword01;
299 };
300 union {
301 struct {
302 uint32_t sync_cp_dma : 1;
303 uint32_t inval_tcp : 1;
304 uint32_t inval_sqI : 1;
305 uint32_t inval_sqK : 1;
306 uint32_t flush_tcc : 1;
307 uint32_t inval_tcc : 1;
308 uint32_t flush_cb : 1;
309 uint32_t inval_cb : 1;
310 uint32_t flush_db : 1;
311 uint32_t inval_db : 1;
312 uint32_t num_layout_transitions : 16;
313 uint32_t inval_gl1 : 1;
314 uint32_t reserved : 5;
315 };
316 uint32_t dword02;
317 };
318 };
319
320 static_assert(sizeof(struct rgp_sqtt_marker_barrier_end) == 8,
321 "rgp_sqtt_marker_barrier_end doesn't match RGP spec");
322
323 /**
324 * "Layout Transition" RGP SQTT instrumentation marker (Table 7)
325 */
326 struct rgp_sqtt_marker_layout_transition {
327 union {
328 struct {
329 uint32_t identifier : 4;
330 uint32_t ext_dwords : 3;
331 uint32_t depth_stencil_expand : 1;
332 uint32_t htile_hiz_range_expand : 1;
333 uint32_t depth_stencil_resummarize : 1;
334 uint32_t dcc_decompress : 1;
335 uint32_t fmask_decompress : 1;
336 uint32_t fast_clear_eliminate : 1;
337 uint32_t fmask_color_expand : 1;
338 uint32_t init_mask_ram : 1;
339 uint32_t reserved1 : 17;
340 };
341 uint32_t dword01;
342 };
343 union {
344 struct {
345 uint32_t reserved2 : 32;
346 };
347 uint32_t dword02;
348 };
349 };
350
351 static_assert(sizeof(struct rgp_sqtt_marker_layout_transition) == 8,
352 "rgp_sqtt_marker_layout_transition doesn't match RGP spec");
353
354 static void
radv_write_begin_general_api_marker(struct radv_cmd_buffer * cmd_buffer,enum rgp_sqtt_marker_general_api_type api_type)355 radv_write_begin_general_api_marker(struct radv_cmd_buffer *cmd_buffer,
356 enum rgp_sqtt_marker_general_api_type api_type)
357 {
358 struct rgp_sqtt_marker_general_api marker = {0};
359 struct radeon_cmdbuf *cs = cmd_buffer->cs;
360
361 marker.identifier = RGP_SQTT_MARKER_IDENTIFIER_GENERAL_API;
362 marker.api_type = api_type;
363
364 radv_emit_thread_trace_userdata(cmd_buffer->device, cs, &marker, sizeof(marker) / 4);
365 }
366
367 static void
radv_write_end_general_api_marker(struct radv_cmd_buffer * cmd_buffer,enum rgp_sqtt_marker_general_api_type api_type)368 radv_write_end_general_api_marker(struct radv_cmd_buffer *cmd_buffer,
369 enum rgp_sqtt_marker_general_api_type api_type)
370 {
371 struct rgp_sqtt_marker_general_api marker = {0};
372 struct radeon_cmdbuf *cs = cmd_buffer->cs;
373
374 marker.identifier = RGP_SQTT_MARKER_IDENTIFIER_GENERAL_API;
375 marker.api_type = api_type;
376 marker.is_end = 1;
377
378 radv_emit_thread_trace_userdata(cmd_buffer->device, cs, &marker, sizeof(marker) / 4);
379 }
380
381 static void
radv_write_event_marker(struct radv_cmd_buffer * cmd_buffer,enum rgp_sqtt_marker_event_type api_type,uint32_t vertex_offset_user_data,uint32_t instance_offset_user_data,uint32_t draw_index_user_data)382 radv_write_event_marker(struct radv_cmd_buffer *cmd_buffer,
383 enum rgp_sqtt_marker_event_type api_type,
384 uint32_t vertex_offset_user_data,
385 uint32_t instance_offset_user_data,
386 uint32_t draw_index_user_data)
387 {
388 struct rgp_sqtt_marker_event marker = {0};
389 struct radeon_cmdbuf *cs = cmd_buffer->cs;
390
391 marker.identifier = RGP_SQTT_MARKER_IDENTIFIER_EVENT;
392 marker.api_type = api_type;
393 marker.cmd_id = cmd_buffer->state.num_events++;
394 marker.cb_id = 0;
395
396 if (vertex_offset_user_data == UINT_MAX ||
397 instance_offset_user_data == UINT_MAX) {
398 vertex_offset_user_data = 0;
399 instance_offset_user_data = 0;
400 }
401
402 if (draw_index_user_data == UINT_MAX)
403 draw_index_user_data = vertex_offset_user_data;
404
405 marker.vertex_offset_reg_idx = vertex_offset_user_data;
406 marker.instance_offset_reg_idx = instance_offset_user_data;
407 marker.draw_index_reg_idx = draw_index_user_data;
408
409 radv_emit_thread_trace_userdata(cmd_buffer->device, cs, &marker, sizeof(marker) / 4);
410 }
411
412 static void
radv_write_event_with_dims_marker(struct radv_cmd_buffer * cmd_buffer,enum rgp_sqtt_marker_event_type api_type,uint32_t x,uint32_t y,uint32_t z)413 radv_write_event_with_dims_marker(struct radv_cmd_buffer *cmd_buffer,
414 enum rgp_sqtt_marker_event_type api_type,
415 uint32_t x, uint32_t y, uint32_t z)
416 {
417 struct rgp_sqtt_marker_event_with_dims marker = {0};
418 struct radeon_cmdbuf *cs = cmd_buffer->cs;
419
420 marker.event.identifier = RGP_SQTT_MARKER_IDENTIFIER_EVENT;
421 marker.event.api_type = api_type;
422 marker.event.cmd_id = cmd_buffer->state.num_events++;
423 marker.event.cb_id = 0;
424 marker.event.has_thread_dims = 1;
425
426 marker.thread_x = x;
427 marker.thread_y = y;
428 marker.thread_z = z;
429
430 radv_emit_thread_trace_userdata(cmd_buffer->device, cs, &marker, sizeof(marker) / 4);
431 }
432
433 void
radv_describe_begin_cmd_buffer(struct radv_cmd_buffer * cmd_buffer)434 radv_describe_begin_cmd_buffer(struct radv_cmd_buffer *cmd_buffer)
435 {
436 uint64_t device_id = (uintptr_t)cmd_buffer->device;
437 struct rgp_sqtt_marker_cb_start marker = {0};
438 struct radeon_cmdbuf *cs = cmd_buffer->cs;
439
440 if (likely(!cmd_buffer->device->thread_trace_bo))
441 return;
442
443 marker.identifier = RGP_SQTT_MARKER_IDENTIFIER_CB_START;
444 marker.cb_id = 0;
445 marker.device_id_low = device_id;
446 marker.device_id_high = device_id >> 32;
447 marker.queue = cmd_buffer->queue_family_index;
448 marker.queue_flags = VK_QUEUE_COMPUTE_BIT |
449 VK_QUEUE_TRANSFER_BIT |
450 VK_QUEUE_SPARSE_BINDING_BIT;
451
452 if (cmd_buffer->queue_family_index == RADV_QUEUE_GENERAL)
453 marker.queue_flags |= VK_QUEUE_GRAPHICS_BIT;
454
455 radv_emit_thread_trace_userdata(cmd_buffer->device, cs, &marker, sizeof(marker) / 4);
456 }
457
458 void
radv_describe_end_cmd_buffer(struct radv_cmd_buffer * cmd_buffer)459 radv_describe_end_cmd_buffer(struct radv_cmd_buffer *cmd_buffer)
460 {
461 uint64_t device_id = (uintptr_t)cmd_buffer->device;
462 struct rgp_sqtt_marker_cb_end marker = {0};
463 struct radeon_cmdbuf *cs = cmd_buffer->cs;
464
465 if (likely(!cmd_buffer->device->thread_trace_bo))
466 return;
467
468 marker.identifier = RGP_SQTT_MARKER_IDENTIFIER_CB_END;
469 marker.cb_id = 0;
470 marker.device_id_low = device_id;
471 marker.device_id_high = device_id >> 32;
472
473 radv_emit_thread_trace_userdata(cmd_buffer->device, cs, &marker, sizeof(marker) / 4);
474 }
475
476 void
radv_describe_draw(struct radv_cmd_buffer * cmd_buffer)477 radv_describe_draw(struct radv_cmd_buffer *cmd_buffer)
478 {
479 if (likely(!cmd_buffer->device->thread_trace_bo))
480 return;
481
482 radv_write_event_marker(cmd_buffer, cmd_buffer->state.current_event_type,
483 UINT_MAX, UINT_MAX, UINT_MAX);
484 }
485
486 void
radv_describe_dispatch(struct radv_cmd_buffer * cmd_buffer,int x,int y,int z)487 radv_describe_dispatch(struct radv_cmd_buffer *cmd_buffer, int x, int y, int z)
488 {
489 if (likely(!cmd_buffer->device->thread_trace_bo))
490 return;
491
492 radv_write_event_with_dims_marker(cmd_buffer,
493 cmd_buffer->state.current_event_type,
494 x, y, z);
495 }
496
497 void
radv_describe_begin_render_pass_clear(struct radv_cmd_buffer * cmd_buffer,VkImageAspectFlagBits aspects)498 radv_describe_begin_render_pass_clear(struct radv_cmd_buffer *cmd_buffer,
499 VkImageAspectFlagBits aspects)
500 {
501 cmd_buffer->state.current_event_type = (aspects & VK_IMAGE_ASPECT_COLOR_BIT) ?
502 EventRenderPassColorClear : EventRenderPassDepthStencilClear;
503 }
504
505 void
radv_describe_end_render_pass_clear(struct radv_cmd_buffer * cmd_buffer)506 radv_describe_end_render_pass_clear(struct radv_cmd_buffer *cmd_buffer)
507 {
508 cmd_buffer->state.current_event_type = EventInternalUnknown;
509 }
510
511 void
radv_describe_barrier_end_delayed(struct radv_cmd_buffer * cmd_buffer)512 radv_describe_barrier_end_delayed(struct radv_cmd_buffer *cmd_buffer)
513 {
514 struct rgp_sqtt_marker_barrier_end marker = {0};
515 struct radeon_cmdbuf *cs = cmd_buffer->cs;
516
517 if (likely(!cmd_buffer->device->thread_trace_bo) ||
518 !cmd_buffer->state.pending_sqtt_barrier_end)
519 return;
520
521 cmd_buffer->state.pending_sqtt_barrier_end = false;
522
523 marker.identifier = RGP_SQTT_MARKER_IDENTIFIER_BARRIER_END;
524 marker.cb_id = 0;
525
526 marker.num_layout_transitions = cmd_buffer->state.num_layout_transitions;
527
528 /* TODO: fill pipeline stalls, cache flushes, etc */
529 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_WAIT_ON_EOP_TS)
530 marker.wait_on_eop_ts = true;
531 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_VS_PARTIAL_FLUSH)
532 marker.vs_partial_flush = true;
533 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_PS_PARTIAL_FLUSH)
534 marker.ps_partial_flush = true;
535 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_CS_PARTIAL_FLUSH)
536 marker.cs_partial_flush = true;
537 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_PFP_SYNC_ME)
538 marker.pfp_sync_me = true;
539 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_SYNC_CP_DMA)
540 marker.sync_cp_dma = true;
541 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_INVAL_VMEM_L0)
542 marker.inval_tcp = true;
543 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_INVAL_ICACHE)
544 marker.inval_sqI = true;
545 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_INVAL_SMEM_L0)
546 marker.inval_sqK = true;
547 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_FLUSH_L2)
548 marker.flush_tcc = true;
549 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_INVAL_L2)
550 marker.inval_tcc = true;
551 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_FLUSH_CB)
552 marker.flush_cb = true;
553 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_INVAL_CB)
554 marker.inval_cb = true;
555 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_FLUSH_DB)
556 marker.flush_db = true;
557 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_INVAL_DB)
558 marker.inval_db = true;
559 if (cmd_buffer->state.sqtt_flush_bits & RGP_FLUSH_INVAL_L1)
560 marker.inval_gl1 = true;
561
562 radv_emit_thread_trace_userdata(cmd_buffer->device, cs, &marker, sizeof(marker) / 4);
563
564 cmd_buffer->state.num_layout_transitions = 0;
565 }
566
567 void
radv_describe_barrier_start(struct radv_cmd_buffer * cmd_buffer,enum rgp_barrier_reason reason)568 radv_describe_barrier_start(struct radv_cmd_buffer *cmd_buffer,
569 enum rgp_barrier_reason reason)
570 {
571 struct rgp_sqtt_marker_barrier_start marker = {0};
572 struct radeon_cmdbuf *cs = cmd_buffer->cs;
573
574 if (likely(!cmd_buffer->device->thread_trace_bo))
575 return;
576
577 radv_describe_barrier_end_delayed(cmd_buffer);
578 cmd_buffer->state.sqtt_flush_bits = 0;
579
580 marker.identifier = RGP_SQTT_MARKER_IDENTIFIER_BARRIER_START;
581 marker.cb_id = 0;
582 marker.dword02 = reason;
583
584 radv_emit_thread_trace_userdata(cmd_buffer->device, cs, &marker, sizeof(marker) / 4);
585 }
586
587 void
radv_describe_barrier_end(struct radv_cmd_buffer * cmd_buffer)588 radv_describe_barrier_end(struct radv_cmd_buffer *cmd_buffer)
589 {
590 cmd_buffer->state.pending_sqtt_barrier_end = true;
591 }
592
593 void
radv_describe_layout_transition(struct radv_cmd_buffer * cmd_buffer,const struct radv_barrier_data * barrier)594 radv_describe_layout_transition(struct radv_cmd_buffer *cmd_buffer,
595 const struct radv_barrier_data *barrier)
596 {
597 struct rgp_sqtt_marker_layout_transition marker = {0};
598 struct radeon_cmdbuf *cs = cmd_buffer->cs;
599
600 if (likely(!cmd_buffer->device->thread_trace_bo))
601 return;
602
603 marker.identifier = RGP_SQTT_MARKER_IDENTIFIER_LAYOUT_TRANSITION;
604 marker.depth_stencil_expand = barrier->layout_transitions.depth_stencil_expand;
605 marker.htile_hiz_range_expand = barrier->layout_transitions.htile_hiz_range_expand;
606 marker.depth_stencil_resummarize = barrier->layout_transitions.depth_stencil_resummarize;
607 marker.dcc_decompress = barrier->layout_transitions.dcc_decompress;
608 marker.fmask_decompress = barrier->layout_transitions.fmask_decompress;
609 marker.fast_clear_eliminate = barrier->layout_transitions.fast_clear_eliminate;
610 marker.fmask_color_expand = barrier->layout_transitions.fmask_color_expand;
611 marker.init_mask_ram = barrier->layout_transitions.init_mask_ram;
612
613 radv_emit_thread_trace_userdata(cmd_buffer->device, cs, &marker, sizeof(marker) / 4);
614
615 cmd_buffer->state.num_layout_transitions++;
616 }
617
618 /* TODO: Improve the way to trigger capture (overlay, etc). */
619 static void
radv_handle_thread_trace(VkQueue _queue)620 radv_handle_thread_trace(VkQueue _queue)
621 {
622 RADV_FROM_HANDLE(radv_queue, queue, _queue);
623 static bool thread_trace_enabled = false;
624 static uint64_t num_frames = 0;
625
626 if (thread_trace_enabled) {
627 struct radv_thread_trace thread_trace = {0};
628
629 radv_end_thread_trace(queue);
630 thread_trace_enabled = false;
631
632 /* TODO: Do something better than this whole sync. */
633 radv_QueueWaitIdle(_queue);
634
635 if (radv_get_thread_trace(queue, &thread_trace))
636 radv_dump_thread_trace(queue->device, &thread_trace);
637 } else {
638 bool frame_trigger = num_frames == queue->device->thread_trace_start_frame;
639 bool file_trigger = false;
640 if (queue->device->thread_trace_trigger_file &&
641 access(queue->device->thread_trace_trigger_file, W_OK) == 0) {
642 if (unlink(queue->device->thread_trace_trigger_file) == 0) {
643 file_trigger = true;
644 } else {
645 /* Do not enable tracing if we cannot remove the file,
646 * because by then we'll trace every frame ... */
647 fprintf(stderr, "RADV: could not remove thread trace trigger file, ignoring\n");
648 }
649 }
650
651 if (frame_trigger || file_trigger) {
652 radv_begin_thread_trace(queue);
653 assert(!thread_trace_enabled);
654 thread_trace_enabled = true;
655 }
656 }
657 num_frames++;
658 }
659
sqtt_QueuePresentKHR(VkQueue _queue,const VkPresentInfoKHR * pPresentInfo)660 VkResult sqtt_QueuePresentKHR(
661 VkQueue _queue,
662 const VkPresentInfoKHR* pPresentInfo)
663 {
664 VkResult result;
665
666 result = radv_QueuePresentKHR(_queue, pPresentInfo);
667 if (result != VK_SUCCESS)
668 return result;
669
670 radv_handle_thread_trace(_queue);
671
672 return VK_SUCCESS;
673 }
674
675 #define EVENT_MARKER(cmd_name, args...) \
676 RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer); \
677 radv_write_begin_general_api_marker(cmd_buffer, ApiCmd##cmd_name); \
678 cmd_buffer->state.current_event_type = EventCmd##cmd_name; \
679 radv_Cmd##cmd_name(args); \
680 cmd_buffer->state.current_event_type = EventInternalUnknown; \
681 radv_write_end_general_api_marker(cmd_buffer, ApiCmd##cmd_name);
682
sqtt_CmdDraw(VkCommandBuffer commandBuffer,uint32_t vertexCount,uint32_t instanceCount,uint32_t firstVertex,uint32_t firstInstance)683 void sqtt_CmdDraw(
684 VkCommandBuffer commandBuffer,
685 uint32_t vertexCount,
686 uint32_t instanceCount,
687 uint32_t firstVertex,
688 uint32_t firstInstance)
689 {
690 EVENT_MARKER(Draw, commandBuffer, vertexCount, instanceCount,
691 firstVertex, firstInstance);
692 }
693
sqtt_CmdDrawIndexed(VkCommandBuffer commandBuffer,uint32_t indexCount,uint32_t instanceCount,uint32_t firstIndex,int32_t vertexOffset,uint32_t firstInstance)694 void sqtt_CmdDrawIndexed(
695 VkCommandBuffer commandBuffer,
696 uint32_t indexCount,
697 uint32_t instanceCount,
698 uint32_t firstIndex,
699 int32_t vertexOffset,
700 uint32_t firstInstance)
701 {
702 EVENT_MARKER(DrawIndexed, commandBuffer, indexCount, instanceCount,
703 firstIndex, vertexOffset, firstInstance);
704 }
705
sqtt_CmdDrawIndirect(VkCommandBuffer commandBuffer,VkBuffer buffer,VkDeviceSize offset,uint32_t drawCount,uint32_t stride)706 void sqtt_CmdDrawIndirect(
707 VkCommandBuffer commandBuffer,
708 VkBuffer buffer,
709 VkDeviceSize offset,
710 uint32_t drawCount,
711 uint32_t stride)
712 {
713 EVENT_MARKER(DrawIndirect, commandBuffer, buffer, offset, drawCount,
714 stride);
715 }
716
sqtt_CmdDrawIndexedIndirect(VkCommandBuffer commandBuffer,VkBuffer buffer,VkDeviceSize offset,uint32_t drawCount,uint32_t stride)717 void sqtt_CmdDrawIndexedIndirect(
718 VkCommandBuffer commandBuffer,
719 VkBuffer buffer,
720 VkDeviceSize offset,
721 uint32_t drawCount,
722 uint32_t stride)
723 {
724 EVENT_MARKER(DrawIndexedIndirect, commandBuffer, buffer, offset,
725 drawCount, stride);
726 }
727
sqtt_CmdDrawIndirectCount(VkCommandBuffer commandBuffer,VkBuffer buffer,VkDeviceSize offset,VkBuffer countBuffer,VkDeviceSize countBufferOffset,uint32_t maxDrawCount,uint32_t stride)728 void sqtt_CmdDrawIndirectCount(
729 VkCommandBuffer commandBuffer,
730 VkBuffer buffer,
731 VkDeviceSize offset,
732 VkBuffer countBuffer,
733 VkDeviceSize countBufferOffset,
734 uint32_t maxDrawCount,
735 uint32_t stride)
736 {
737 EVENT_MARKER(DrawIndirectCount,commandBuffer, buffer, offset,
738 countBuffer, countBufferOffset, maxDrawCount, stride);
739 }
740
sqtt_CmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer,VkBuffer buffer,VkDeviceSize offset,VkBuffer countBuffer,VkDeviceSize countBufferOffset,uint32_t maxDrawCount,uint32_t stride)741 void sqtt_CmdDrawIndexedIndirectCount(
742 VkCommandBuffer commandBuffer,
743 VkBuffer buffer,
744 VkDeviceSize offset,
745 VkBuffer countBuffer,
746 VkDeviceSize countBufferOffset,
747 uint32_t maxDrawCount,
748 uint32_t stride)
749 {
750 EVENT_MARKER(DrawIndexedIndirectCount, commandBuffer, buffer, offset,
751 countBuffer, countBufferOffset, maxDrawCount, stride);
752 }
753
sqtt_CmdDispatch(VkCommandBuffer commandBuffer,uint32_t x,uint32_t y,uint32_t z)754 void sqtt_CmdDispatch(
755 VkCommandBuffer commandBuffer,
756 uint32_t x,
757 uint32_t y,
758 uint32_t z)
759 {
760 EVENT_MARKER(Dispatch, commandBuffer, x, y, z);
761 }
762
sqtt_CmdDispatchIndirect(VkCommandBuffer commandBuffer,VkBuffer buffer,VkDeviceSize offset)763 void sqtt_CmdDispatchIndirect(
764 VkCommandBuffer commandBuffer,
765 VkBuffer buffer,
766 VkDeviceSize offset)
767 {
768 EVENT_MARKER(DispatchIndirect, commandBuffer, buffer, offset);
769 }
770
sqtt_CmdCopyBuffer(VkCommandBuffer commandBuffer,VkBuffer srcBuffer,VkBuffer destBuffer,uint32_t regionCount,const VkBufferCopy * pRegions)771 void sqtt_CmdCopyBuffer(
772 VkCommandBuffer commandBuffer,
773 VkBuffer srcBuffer,
774 VkBuffer destBuffer,
775 uint32_t regionCount,
776 const VkBufferCopy* pRegions)
777 {
778 EVENT_MARKER(CopyBuffer, commandBuffer, srcBuffer, destBuffer,
779 regionCount, pRegions);
780 }
781
sqtt_CmdFillBuffer(VkCommandBuffer commandBuffer,VkBuffer dstBuffer,VkDeviceSize dstOffset,VkDeviceSize fillSize,uint32_t data)782 void sqtt_CmdFillBuffer(
783 VkCommandBuffer commandBuffer,
784 VkBuffer dstBuffer,
785 VkDeviceSize dstOffset,
786 VkDeviceSize fillSize,
787 uint32_t data)
788 {
789 EVENT_MARKER(FillBuffer, commandBuffer, dstBuffer, dstOffset, fillSize,
790 data);
791 }
792
sqtt_CmdUpdateBuffer(VkCommandBuffer commandBuffer,VkBuffer dstBuffer,VkDeviceSize dstOffset,VkDeviceSize dataSize,const void * pData)793 void sqtt_CmdUpdateBuffer(
794 VkCommandBuffer commandBuffer,
795 VkBuffer dstBuffer,
796 VkDeviceSize dstOffset,
797 VkDeviceSize dataSize,
798 const void* pData)
799 {
800 EVENT_MARKER(UpdateBuffer, commandBuffer, dstBuffer, dstOffset,
801 dataSize, pData);
802 }
803
sqtt_CmdCopyImage(VkCommandBuffer commandBuffer,VkImage srcImage,VkImageLayout srcImageLayout,VkImage destImage,VkImageLayout destImageLayout,uint32_t regionCount,const VkImageCopy * pRegions)804 void sqtt_CmdCopyImage(
805 VkCommandBuffer commandBuffer,
806 VkImage srcImage,
807 VkImageLayout srcImageLayout,
808 VkImage destImage,
809 VkImageLayout destImageLayout,
810 uint32_t regionCount,
811 const VkImageCopy* pRegions)
812 {
813 EVENT_MARKER(CopyImage, commandBuffer, srcImage, srcImageLayout,
814 destImage, destImageLayout, regionCount, pRegions);
815 }
816
sqtt_CmdCopyBufferToImage(VkCommandBuffer commandBuffer,VkBuffer srcBuffer,VkImage destImage,VkImageLayout destImageLayout,uint32_t regionCount,const VkBufferImageCopy * pRegions)817 void sqtt_CmdCopyBufferToImage(
818 VkCommandBuffer commandBuffer,
819 VkBuffer srcBuffer,
820 VkImage destImage,
821 VkImageLayout destImageLayout,
822 uint32_t regionCount,
823 const VkBufferImageCopy* pRegions)
824 {
825 EVENT_MARKER(CopyBufferToImage, commandBuffer, srcBuffer, destImage,
826 destImageLayout, regionCount, pRegions);
827 }
828
sqtt_CmdCopyImageToBuffer(VkCommandBuffer commandBuffer,VkImage srcImage,VkImageLayout srcImageLayout,VkBuffer destBuffer,uint32_t regionCount,const VkBufferImageCopy * pRegions)829 void sqtt_CmdCopyImageToBuffer(
830 VkCommandBuffer commandBuffer,
831 VkImage srcImage,
832 VkImageLayout srcImageLayout,
833 VkBuffer destBuffer,
834 uint32_t regionCount,
835 const VkBufferImageCopy* pRegions)
836 {
837 EVENT_MARKER(CopyImageToBuffer, commandBuffer, srcImage, srcImageLayout,
838 destBuffer, regionCount, pRegions);
839 }
840
sqtt_CmdBlitImage(VkCommandBuffer commandBuffer,VkImage srcImage,VkImageLayout srcImageLayout,VkImage destImage,VkImageLayout destImageLayout,uint32_t regionCount,const VkImageBlit * pRegions,VkFilter filter)841 void sqtt_CmdBlitImage(
842 VkCommandBuffer commandBuffer,
843 VkImage srcImage,
844 VkImageLayout srcImageLayout,
845 VkImage destImage,
846 VkImageLayout destImageLayout,
847 uint32_t regionCount,
848 const VkImageBlit* pRegions,
849 VkFilter filter)
850 {
851 EVENT_MARKER(BlitImage, commandBuffer, srcImage, srcImageLayout,
852 destImage, destImageLayout, regionCount, pRegions, filter);
853 }
854
sqtt_CmdClearColorImage(VkCommandBuffer commandBuffer,VkImage image_h,VkImageLayout imageLayout,const VkClearColorValue * pColor,uint32_t rangeCount,const VkImageSubresourceRange * pRanges)855 void sqtt_CmdClearColorImage(
856 VkCommandBuffer commandBuffer,
857 VkImage image_h,
858 VkImageLayout imageLayout,
859 const VkClearColorValue* pColor,
860 uint32_t rangeCount,
861 const VkImageSubresourceRange* pRanges)
862 {
863 EVENT_MARKER(ClearColorImage, commandBuffer, image_h, imageLayout,
864 pColor, rangeCount, pRanges);
865 }
866
sqtt_CmdClearDepthStencilImage(VkCommandBuffer commandBuffer,VkImage image_h,VkImageLayout imageLayout,const VkClearDepthStencilValue * pDepthStencil,uint32_t rangeCount,const VkImageSubresourceRange * pRanges)867 void sqtt_CmdClearDepthStencilImage(
868 VkCommandBuffer commandBuffer,
869 VkImage image_h,
870 VkImageLayout imageLayout,
871 const VkClearDepthStencilValue* pDepthStencil,
872 uint32_t rangeCount,
873 const VkImageSubresourceRange* pRanges)
874 {
875 EVENT_MARKER(ClearDepthStencilImage, commandBuffer, image_h,
876 imageLayout, pDepthStencil, rangeCount, pRanges);
877 }
878
sqtt_CmdClearAttachments(VkCommandBuffer commandBuffer,uint32_t attachmentCount,const VkClearAttachment * pAttachments,uint32_t rectCount,const VkClearRect * pRects)879 void sqtt_CmdClearAttachments(
880 VkCommandBuffer commandBuffer,
881 uint32_t attachmentCount,
882 const VkClearAttachment* pAttachments,
883 uint32_t rectCount,
884 const VkClearRect* pRects)
885 {
886 EVENT_MARKER(ClearAttachments, commandBuffer, attachmentCount,
887 pAttachments, rectCount, pRects);
888 }
889
sqtt_CmdResolveImage(VkCommandBuffer commandBuffer,VkImage src_image_h,VkImageLayout src_image_layout,VkImage dest_image_h,VkImageLayout dest_image_layout,uint32_t region_count,const VkImageResolve * regions)890 void sqtt_CmdResolveImage(
891 VkCommandBuffer commandBuffer,
892 VkImage src_image_h,
893 VkImageLayout src_image_layout,
894 VkImage dest_image_h,
895 VkImageLayout dest_image_layout,
896 uint32_t region_count,
897 const VkImageResolve* regions)
898 {
899 EVENT_MARKER(ResolveImage, commandBuffer, src_image_h, src_image_layout,
900 dest_image_h, dest_image_layout, region_count, regions);
901 }
902
sqtt_CmdWaitEvents(VkCommandBuffer commandBuffer,uint32_t eventCount,const VkEvent * pEvents,VkPipelineStageFlags srcStageMask,VkPipelineStageFlags dstStageMask,uint32_t memoryBarrierCount,const VkMemoryBarrier * pMemoryBarriers,uint32_t bufferMemoryBarrierCount,const VkBufferMemoryBarrier * pBufferMemoryBarriers,uint32_t imageMemoryBarrierCount,const VkImageMemoryBarrier * pImageMemoryBarriers)903 void sqtt_CmdWaitEvents(VkCommandBuffer commandBuffer,
904 uint32_t eventCount,
905 const VkEvent* pEvents,
906 VkPipelineStageFlags srcStageMask,
907 VkPipelineStageFlags dstStageMask,
908 uint32_t memoryBarrierCount,
909 const VkMemoryBarrier* pMemoryBarriers,
910 uint32_t bufferMemoryBarrierCount,
911 const VkBufferMemoryBarrier* pBufferMemoryBarriers,
912 uint32_t imageMemoryBarrierCount,
913 const VkImageMemoryBarrier* pImageMemoryBarriers)
914 {
915 EVENT_MARKER(WaitEvents, commandBuffer, eventCount, pEvents,
916 srcStageMask, dstStageMask, memoryBarrierCount,
917 pMemoryBarriers, bufferMemoryBarrierCount,
918 pBufferMemoryBarriers, imageMemoryBarrierCount,
919 pImageMemoryBarriers);
920 }
921
sqtt_CmdPipelineBarrier(VkCommandBuffer commandBuffer,VkPipelineStageFlags srcStageMask,VkPipelineStageFlags destStageMask,VkBool32 byRegion,uint32_t memoryBarrierCount,const VkMemoryBarrier * pMemoryBarriers,uint32_t bufferMemoryBarrierCount,const VkBufferMemoryBarrier * pBufferMemoryBarriers,uint32_t imageMemoryBarrierCount,const VkImageMemoryBarrier * pImageMemoryBarriers)922 void sqtt_CmdPipelineBarrier(
923 VkCommandBuffer commandBuffer,
924 VkPipelineStageFlags srcStageMask,
925 VkPipelineStageFlags destStageMask,
926 VkBool32 byRegion,
927 uint32_t memoryBarrierCount,
928 const VkMemoryBarrier* pMemoryBarriers,
929 uint32_t bufferMemoryBarrierCount,
930 const VkBufferMemoryBarrier* pBufferMemoryBarriers,
931 uint32_t imageMemoryBarrierCount,
932 const VkImageMemoryBarrier* pImageMemoryBarriers)
933 {
934 EVENT_MARKER(PipelineBarrier, commandBuffer, srcStageMask,
935 destStageMask, byRegion, memoryBarrierCount,
936 pMemoryBarriers, bufferMemoryBarrierCount,
937 pBufferMemoryBarriers, imageMemoryBarrierCount,
938 pImageMemoryBarriers);
939 }
940
sqtt_CmdResetQueryPool(VkCommandBuffer commandBuffer,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount)941 void sqtt_CmdResetQueryPool(
942 VkCommandBuffer commandBuffer,
943 VkQueryPool queryPool,
944 uint32_t firstQuery,
945 uint32_t queryCount)
946 {
947 EVENT_MARKER(ResetQueryPool, commandBuffer, queryPool, firstQuery,
948 queryCount);
949 }
950
sqtt_CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount,VkBuffer dstBuffer,VkDeviceSize dstOffset,VkDeviceSize stride,VkQueryResultFlags flags)951 void sqtt_CmdCopyQueryPoolResults(
952 VkCommandBuffer commandBuffer,
953 VkQueryPool queryPool,
954 uint32_t firstQuery,
955 uint32_t queryCount,
956 VkBuffer dstBuffer,
957 VkDeviceSize dstOffset,
958 VkDeviceSize stride,
959 VkQueryResultFlags flags)
960 {
961 EVENT_MARKER(CopyQueryPoolResults, commandBuffer, queryPool, firstQuery,
962 queryCount, dstBuffer, dstOffset, stride,
963 flags);
964 }
965
966 #undef EVENT_MARKER
967 #define API_MARKER(cmd_name, args...) \
968 RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer); \
969 radv_write_begin_general_api_marker(cmd_buffer, ApiCmd##cmd_name); \
970 radv_Cmd##cmd_name(args); \
971 radv_write_end_general_api_marker(cmd_buffer, ApiCmd##cmd_name);
972
sqtt_CmdBindPipeline(VkCommandBuffer commandBuffer,VkPipelineBindPoint pipelineBindPoint,VkPipeline pipeline)973 void sqtt_CmdBindPipeline(
974 VkCommandBuffer commandBuffer,
975 VkPipelineBindPoint pipelineBindPoint,
976 VkPipeline pipeline)
977 {
978 API_MARKER(BindPipeline, commandBuffer, pipelineBindPoint, pipeline);
979 }
980
sqtt_CmdBindDescriptorSets(VkCommandBuffer commandBuffer,VkPipelineBindPoint pipelineBindPoint,VkPipelineLayout layout,uint32_t firstSet,uint32_t descriptorSetCount,const VkDescriptorSet * pDescriptorSets,uint32_t dynamicOffsetCount,const uint32_t * pDynamicOffsets)981 void sqtt_CmdBindDescriptorSets(
982 VkCommandBuffer commandBuffer,
983 VkPipelineBindPoint pipelineBindPoint,
984 VkPipelineLayout layout,
985 uint32_t firstSet,
986 uint32_t descriptorSetCount,
987 const VkDescriptorSet* pDescriptorSets,
988 uint32_t dynamicOffsetCount,
989 const uint32_t* pDynamicOffsets)
990 {
991 API_MARKER(BindDescriptorSets, commandBuffer, pipelineBindPoint,
992 layout, firstSet, descriptorSetCount,
993 pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
994 }
995
sqtt_CmdBindIndexBuffer(VkCommandBuffer commandBuffer,VkBuffer buffer,VkDeviceSize offset,VkIndexType indexType)996 void sqtt_CmdBindIndexBuffer(
997 VkCommandBuffer commandBuffer,
998 VkBuffer buffer,
999 VkDeviceSize offset,
1000 VkIndexType indexType)
1001 {
1002 API_MARKER(BindIndexBuffer, commandBuffer, buffer, offset, indexType);
1003 }
1004
sqtt_CmdBindVertexBuffers(VkCommandBuffer commandBuffer,uint32_t firstBinding,uint32_t bindingCount,const VkBuffer * pBuffers,const VkDeviceSize * pOffsets)1005 void sqtt_CmdBindVertexBuffers(
1006 VkCommandBuffer commandBuffer,
1007 uint32_t firstBinding,
1008 uint32_t bindingCount,
1009 const VkBuffer* pBuffers,
1010 const VkDeviceSize* pOffsets)
1011 {
1012 API_MARKER(BindVertexBuffers, commandBuffer, firstBinding, bindingCount,
1013 pBuffers, pOffsets);
1014 }
1015
sqtt_CmdBeginQuery(VkCommandBuffer commandBuffer,VkQueryPool queryPool,uint32_t query,VkQueryControlFlags flags)1016 void sqtt_CmdBeginQuery(
1017 VkCommandBuffer commandBuffer,
1018 VkQueryPool queryPool,
1019 uint32_t query,
1020 VkQueryControlFlags flags)
1021 {
1022 API_MARKER(BeginQuery, commandBuffer, queryPool, query, flags);
1023 }
1024
sqtt_CmdEndQuery(VkCommandBuffer commandBuffer,VkQueryPool queryPool,uint32_t query)1025 void sqtt_CmdEndQuery(
1026 VkCommandBuffer commandBuffer,
1027 VkQueryPool queryPool,
1028 uint32_t query)
1029 {
1030 API_MARKER(EndQuery, commandBuffer, queryPool, query);
1031 }
1032
sqtt_CmdWriteTimestamp(VkCommandBuffer commandBuffer,VkPipelineStageFlagBits pipelineStage,VkQueryPool queryPool,uint32_t flags)1033 void sqtt_CmdWriteTimestamp(
1034 VkCommandBuffer commandBuffer,
1035 VkPipelineStageFlagBits pipelineStage,
1036 VkQueryPool queryPool,
1037 uint32_t flags)
1038 {
1039 API_MARKER(WriteTimestamp, commandBuffer, pipelineStage, queryPool, flags);
1040 }
1041
sqtt_CmdPushConstants(VkCommandBuffer commandBuffer,VkPipelineLayout layout,VkShaderStageFlags stageFlags,uint32_t offset,uint32_t size,const void * pValues)1042 void sqtt_CmdPushConstants(
1043 VkCommandBuffer commandBuffer,
1044 VkPipelineLayout layout,
1045 VkShaderStageFlags stageFlags,
1046 uint32_t offset,
1047 uint32_t size,
1048 const void* pValues)
1049 {
1050 API_MARKER(PushConstants, commandBuffer, layout, stageFlags, offset,
1051 size, pValues);
1052 }
1053
sqtt_CmdBeginRenderPass(VkCommandBuffer commandBuffer,const VkRenderPassBeginInfo * pRenderPassBegin,VkSubpassContents contents)1054 void sqtt_CmdBeginRenderPass(
1055 VkCommandBuffer commandBuffer,
1056 const VkRenderPassBeginInfo* pRenderPassBegin,
1057 VkSubpassContents contents)
1058 {
1059 API_MARKER(BeginRenderPass, commandBuffer, pRenderPassBegin, contents);
1060 }
1061
sqtt_CmdNextSubpass(VkCommandBuffer commandBuffer,VkSubpassContents contents)1062 void sqtt_CmdNextSubpass(
1063 VkCommandBuffer commandBuffer,
1064 VkSubpassContents contents)
1065 {
1066 API_MARKER(NextSubpass, commandBuffer, contents);
1067 }
1068
sqtt_CmdEndRenderPass(VkCommandBuffer commandBuffer)1069 void sqtt_CmdEndRenderPass(
1070 VkCommandBuffer commandBuffer)
1071 {
1072 API_MARKER(EndRenderPass, commandBuffer);
1073 }
1074
sqtt_CmdExecuteCommands(VkCommandBuffer commandBuffer,uint32_t commandBufferCount,const VkCommandBuffer * pCmdBuffers)1075 void sqtt_CmdExecuteCommands(
1076 VkCommandBuffer commandBuffer,
1077 uint32_t commandBufferCount,
1078 const VkCommandBuffer* pCmdBuffers)
1079 {
1080 API_MARKER(ExecuteCommands, commandBuffer, commandBufferCount,
1081 pCmdBuffers);
1082 }
1083
sqtt_CmdSetViewport(VkCommandBuffer commandBuffer,uint32_t firstViewport,uint32_t viewportCount,const VkViewport * pViewports)1084 void sqtt_CmdSetViewport(
1085 VkCommandBuffer commandBuffer,
1086 uint32_t firstViewport,
1087 uint32_t viewportCount,
1088 const VkViewport* pViewports)
1089 {
1090 API_MARKER(SetViewport, commandBuffer, firstViewport, viewportCount,
1091 pViewports);
1092 }
1093
sqtt_CmdSetScissor(VkCommandBuffer commandBuffer,uint32_t firstScissor,uint32_t scissorCount,const VkRect2D * pScissors)1094 void sqtt_CmdSetScissor(
1095 VkCommandBuffer commandBuffer,
1096 uint32_t firstScissor,
1097 uint32_t scissorCount,
1098 const VkRect2D* pScissors)
1099 {
1100 API_MARKER(SetScissor, commandBuffer, firstScissor, scissorCount,
1101 pScissors);
1102 }
1103
sqtt_CmdSetLineWidth(VkCommandBuffer commandBuffer,float lineWidth)1104 void sqtt_CmdSetLineWidth(
1105 VkCommandBuffer commandBuffer,
1106 float lineWidth)
1107 {
1108 API_MARKER(SetLineWidth, commandBuffer, lineWidth);
1109 }
1110
sqtt_CmdSetDepthBias(VkCommandBuffer commandBuffer,float depthBiasConstantFactor,float depthBiasClamp,float depthBiasSlopeFactor)1111 void sqtt_CmdSetDepthBias(
1112 VkCommandBuffer commandBuffer,
1113 float depthBiasConstantFactor,
1114 float depthBiasClamp,
1115 float depthBiasSlopeFactor)
1116 {
1117 API_MARKER(SetDepthBias, commandBuffer, depthBiasConstantFactor,
1118 depthBiasClamp, depthBiasSlopeFactor);
1119 }
1120
sqtt_CmdSetBlendConstants(VkCommandBuffer commandBuffer,const float blendConstants[4])1121 void sqtt_CmdSetBlendConstants(
1122 VkCommandBuffer commandBuffer,
1123 const float blendConstants[4])
1124 {
1125 API_MARKER(SetBlendConstants, commandBuffer, blendConstants);
1126 }
1127
sqtt_CmdSetDepthBounds(VkCommandBuffer commandBuffer,float minDepthBounds,float maxDepthBounds)1128 void sqtt_CmdSetDepthBounds(
1129 VkCommandBuffer commandBuffer,
1130 float minDepthBounds,
1131 float maxDepthBounds)
1132 {
1133 API_MARKER(SetDepthBounds, commandBuffer, minDepthBounds,
1134 maxDepthBounds);
1135 }
1136
sqtt_CmdSetStencilCompareMask(VkCommandBuffer commandBuffer,VkStencilFaceFlags faceMask,uint32_t compareMask)1137 void sqtt_CmdSetStencilCompareMask(
1138 VkCommandBuffer commandBuffer,
1139 VkStencilFaceFlags faceMask,
1140 uint32_t compareMask)
1141 {
1142 API_MARKER(SetStencilCompareMask, commandBuffer, faceMask, compareMask);
1143 }
1144
sqtt_CmdSetStencilWriteMask(VkCommandBuffer commandBuffer,VkStencilFaceFlags faceMask,uint32_t writeMask)1145 void sqtt_CmdSetStencilWriteMask(
1146 VkCommandBuffer commandBuffer,
1147 VkStencilFaceFlags faceMask,
1148 uint32_t writeMask)
1149 {
1150 API_MARKER(SetStencilWriteMask, commandBuffer, faceMask, writeMask);
1151 }
1152
sqtt_CmdSetStencilReference(VkCommandBuffer commandBuffer,VkStencilFaceFlags faceMask,uint32_t reference)1153 void sqtt_CmdSetStencilReference(
1154 VkCommandBuffer commandBuffer,
1155 VkStencilFaceFlags faceMask,
1156 uint32_t reference)
1157 {
1158 API_MARKER(SetStencilReference, commandBuffer, faceMask, reference);
1159 }
1160
1161 #undef API_MARKER
1162