1 /**************************************************************************
2 *
3 * Copyright 2008 VMware, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28
29 #include "pipe/p_compiler.h"
30 #include "util/u_memory.h"
31 #include "util/format/u_format.h"
32 #include "tgsi/tgsi_dump.h"
33
34 #include "tr_dump.h"
35 #include "tr_dump_defines.h"
36 #include "tr_dump_state.h"
37
38
trace_dump_resource_template(const struct pipe_resource * templat)39 void trace_dump_resource_template(const struct pipe_resource *templat)
40 {
41 if (!trace_dumping_enabled_locked())
42 return;
43
44 if (!templat) {
45 trace_dump_null();
46 return;
47 }
48
49 trace_dump_struct_begin("pipe_resource");
50
51 trace_dump_member(int, templat, target);
52 trace_dump_member(format, templat, format);
53
54 trace_dump_member_begin("width");
55 trace_dump_uint(templat->width0);
56 trace_dump_member_end();
57
58 trace_dump_member_begin("height");
59 trace_dump_uint(templat->height0);
60 trace_dump_member_end();
61
62 trace_dump_member_begin("depth");
63 trace_dump_uint(templat->depth0);
64 trace_dump_member_end();
65
66 trace_dump_member_begin("array_size");
67 trace_dump_uint(templat->array_size);
68 trace_dump_member_end();
69
70 trace_dump_member(uint, templat, last_level);
71 trace_dump_member(uint, templat, nr_samples);
72 trace_dump_member(uint, templat, nr_storage_samples);
73 trace_dump_member(uint, templat, usage);
74 trace_dump_member(uint, templat, bind);
75 trace_dump_member(uint, templat, flags);
76
77 trace_dump_struct_end();
78 }
79
80
trace_dump_box(const struct pipe_box * box)81 void trace_dump_box(const struct pipe_box *box)
82 {
83 if (!trace_dumping_enabled_locked())
84 return;
85
86 if (!box) {
87 trace_dump_null();
88 return;
89 }
90
91 trace_dump_struct_begin("pipe_box");
92
93 trace_dump_member(int, box, x);
94 trace_dump_member(int, box, y);
95 trace_dump_member(int, box, z);
96 trace_dump_member(int, box, width);
97 trace_dump_member(int, box, height);
98 trace_dump_member(int, box, depth);
99
100 trace_dump_struct_end();
101 }
102
103
trace_dump_rasterizer_state(const struct pipe_rasterizer_state * state)104 void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state)
105 {
106 if (!trace_dumping_enabled_locked())
107 return;
108
109 if (!state) {
110 trace_dump_null();
111 return;
112 }
113
114 trace_dump_struct_begin("pipe_rasterizer_state");
115
116 trace_dump_member(bool, state, flatshade);
117 trace_dump_member(bool, state, light_twoside);
118 trace_dump_member(bool, state, clamp_vertex_color);
119 trace_dump_member(bool, state, clamp_fragment_color);
120 trace_dump_member(uint, state, front_ccw);
121 trace_dump_member(uint, state, cull_face);
122 trace_dump_member(uint, state, fill_front);
123 trace_dump_member(uint, state, fill_back);
124 trace_dump_member(bool, state, offset_point);
125 trace_dump_member(bool, state, offset_line);
126 trace_dump_member(bool, state, offset_tri);
127 trace_dump_member(bool, state, scissor);
128 trace_dump_member(bool, state, poly_smooth);
129 trace_dump_member(bool, state, poly_stipple_enable);
130 trace_dump_member(bool, state, point_smooth);
131 trace_dump_member(bool, state, sprite_coord_mode);
132 trace_dump_member(bool, state, point_quad_rasterization);
133 trace_dump_member(bool, state, point_size_per_vertex);
134 trace_dump_member(bool, state, multisample);
135 trace_dump_member(bool, state, line_smooth);
136 trace_dump_member(bool, state, line_stipple_enable);
137 trace_dump_member(bool, state, line_last_pixel);
138
139 trace_dump_member(bool, state, flatshade_first);
140
141 trace_dump_member(bool, state, half_pixel_center);
142 trace_dump_member(bool, state, bottom_edge_rule);
143
144 trace_dump_member(bool, state, rasterizer_discard);
145
146 trace_dump_member(bool, state, depth_clip_near);
147 trace_dump_member(bool, state, depth_clip_far);
148
149 trace_dump_member(bool, state, clip_halfz);
150
151 trace_dump_member(uint, state, clip_plane_enable);
152
153 trace_dump_member(uint, state, line_stipple_factor);
154 trace_dump_member(uint, state, line_stipple_pattern);
155
156 trace_dump_member(uint, state, sprite_coord_enable);
157
158 trace_dump_member(float, state, line_width);
159 trace_dump_member(float, state, point_size);
160 trace_dump_member(float, state, offset_units);
161 trace_dump_member(float, state, offset_scale);
162 trace_dump_member(float, state, offset_clamp);
163
164 trace_dump_struct_end();
165 }
166
167
trace_dump_poly_stipple(const struct pipe_poly_stipple * state)168 void trace_dump_poly_stipple(const struct pipe_poly_stipple *state)
169 {
170 if (!trace_dumping_enabled_locked())
171 return;
172
173 if (!state) {
174 trace_dump_null();
175 return;
176 }
177
178 trace_dump_struct_begin("pipe_poly_stipple");
179
180 trace_dump_member_begin("stipple");
181 trace_dump_array(uint,
182 state->stipple,
183 ARRAY_SIZE(state->stipple));
184 trace_dump_member_end();
185
186 trace_dump_struct_end();
187 }
188
189
trace_dump_viewport_state(const struct pipe_viewport_state * state)190 void trace_dump_viewport_state(const struct pipe_viewport_state *state)
191 {
192 if (!trace_dumping_enabled_locked())
193 return;
194
195 if (!state) {
196 trace_dump_null();
197 return;
198 }
199
200 trace_dump_struct_begin("pipe_viewport_state");
201
202 trace_dump_member_array(float, state, scale);
203 trace_dump_member_array(float, state, translate);
204
205 trace_dump_struct_end();
206 }
207
208
trace_dump_scissor_state(const struct pipe_scissor_state * state)209 void trace_dump_scissor_state(const struct pipe_scissor_state *state)
210 {
211 if (!trace_dumping_enabled_locked())
212 return;
213
214 if (!state) {
215 trace_dump_null();
216 return;
217 }
218
219 trace_dump_struct_begin("pipe_scissor_state");
220
221 trace_dump_member(uint, state, minx);
222 trace_dump_member(uint, state, miny);
223 trace_dump_member(uint, state, maxx);
224 trace_dump_member(uint, state, maxy);
225
226 trace_dump_struct_end();
227 }
228
229
trace_dump_clip_state(const struct pipe_clip_state * state)230 void trace_dump_clip_state(const struct pipe_clip_state *state)
231 {
232 unsigned i;
233
234 if (!trace_dumping_enabled_locked())
235 return;
236
237 if (!state) {
238 trace_dump_null();
239 return;
240 }
241
242 trace_dump_struct_begin("pipe_clip_state");
243
244 trace_dump_member_begin("ucp");
245 trace_dump_array_begin();
246 for(i = 0; i < PIPE_MAX_CLIP_PLANES; ++i) {
247 trace_dump_elem_begin();
248 trace_dump_array(float, state->ucp[i], 4);
249 trace_dump_elem_end();
250 }
251 trace_dump_array_end();
252 trace_dump_member_end();
253
254 trace_dump_struct_end();
255 }
256
257
trace_dump_shader_state(const struct pipe_shader_state * state)258 void trace_dump_shader_state(const struct pipe_shader_state *state)
259 {
260 unsigned i;
261
262 if (!trace_dumping_enabled_locked())
263 return;
264
265 if (!state) {
266 trace_dump_null();
267 return;
268 }
269
270
271 trace_dump_struct_begin("pipe_shader_state");
272
273 trace_dump_member_begin("tokens");
274 if (state->tokens) {
275 static char str[64 * 1024];
276 tgsi_dump_str(state->tokens, 0, str, sizeof(str));
277 trace_dump_string(str);
278 } else {
279 trace_dump_null();
280 }
281 trace_dump_member_end();
282
283 trace_dump_member_begin("stream_output");
284 trace_dump_struct_begin("pipe_stream_output_info");
285 trace_dump_member(uint, &state->stream_output, num_outputs);
286 trace_dump_member_array(uint, &state->stream_output, stride);
287 trace_dump_member_begin("output");
288 trace_dump_array_begin();
289 for(i = 0; i < state->stream_output.num_outputs; ++i) {
290 trace_dump_elem_begin();
291 trace_dump_struct_begin(""); /* anonymous */
292 trace_dump_member(uint, &state->stream_output.output[i], register_index);
293 trace_dump_member(uint, &state->stream_output.output[i], start_component);
294 trace_dump_member(uint, &state->stream_output.output[i], num_components);
295 trace_dump_member(uint, &state->stream_output.output[i], output_buffer);
296 trace_dump_member(uint, &state->stream_output.output[i], dst_offset);
297 trace_dump_member(uint, &state->stream_output.output[i], stream);
298 trace_dump_struct_end();
299 trace_dump_elem_end();
300 }
301 trace_dump_array_end();
302 trace_dump_member_end(); // output
303 trace_dump_struct_end();
304 trace_dump_member_end(); // stream_output
305
306 trace_dump_struct_end();
307 }
308
309
trace_dump_compute_state(const struct pipe_compute_state * state)310 void trace_dump_compute_state(const struct pipe_compute_state *state)
311 {
312 if (!trace_dumping_enabled_locked())
313 return;
314
315 if (!state) {
316 trace_dump_null();
317 return;
318 }
319
320 trace_dump_struct_begin("pipe_compute_state");
321
322 trace_dump_member(uint, state, ir_type);
323
324 trace_dump_member_begin("prog");
325 if (state->prog && state->ir_type == PIPE_SHADER_IR_TGSI) {
326 static char str[64 * 1024];
327 tgsi_dump_str(state->prog, 0, str, sizeof(str));
328 trace_dump_string(str);
329 } else {
330 trace_dump_null();
331 }
332 trace_dump_member_end();
333
334 trace_dump_member(uint, state, req_local_mem);
335 trace_dump_member(uint, state, req_private_mem);
336 trace_dump_member(uint, state, req_input_mem);
337
338 trace_dump_struct_end();
339 }
340
341
trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state * state)342 void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state *state)
343 {
344 unsigned i;
345
346 if (!trace_dumping_enabled_locked())
347 return;
348
349 if (!state) {
350 trace_dump_null();
351 return;
352 }
353
354 trace_dump_struct_begin("pipe_depth_stencil_alpha_state");
355
356 trace_dump_member_begin("depth");
357 trace_dump_struct_begin("pipe_depth_state");
358 trace_dump_member(bool, &state->depth, enabled);
359 trace_dump_member(bool, &state->depth, writemask);
360 trace_dump_member(uint, &state->depth, func);
361 trace_dump_struct_end();
362 trace_dump_member_end();
363
364 trace_dump_member_begin("stencil");
365 trace_dump_array_begin();
366 for(i = 0; i < ARRAY_SIZE(state->stencil); ++i) {
367 trace_dump_elem_begin();
368 trace_dump_struct_begin("pipe_stencil_state");
369 trace_dump_member(bool, &state->stencil[i], enabled);
370 trace_dump_member(uint, &state->stencil[i], func);
371 trace_dump_member(uint, &state->stencil[i], fail_op);
372 trace_dump_member(uint, &state->stencil[i], zpass_op);
373 trace_dump_member(uint, &state->stencil[i], zfail_op);
374 trace_dump_member(uint, &state->stencil[i], valuemask);
375 trace_dump_member(uint, &state->stencil[i], writemask);
376 trace_dump_struct_end();
377 trace_dump_elem_end();
378 }
379 trace_dump_array_end();
380 trace_dump_member_end();
381
382 trace_dump_member_begin("alpha");
383 trace_dump_struct_begin("pipe_alpha_state");
384 trace_dump_member(bool, &state->alpha, enabled);
385 trace_dump_member(uint, &state->alpha, func);
386 trace_dump_member(float, &state->alpha, ref_value);
387 trace_dump_struct_end();
388 trace_dump_member_end();
389
390 trace_dump_struct_end();
391 }
392
trace_dump_rt_blend_state(const struct pipe_rt_blend_state * state)393 static void trace_dump_rt_blend_state(const struct pipe_rt_blend_state *state)
394 {
395 trace_dump_struct_begin("pipe_rt_blend_state");
396
397 trace_dump_member(uint, state, blend_enable);
398
399 trace_dump_member(uint, state, rgb_func);
400 trace_dump_member(uint, state, rgb_src_factor);
401 trace_dump_member(uint, state, rgb_dst_factor);
402
403 trace_dump_member(uint, state, alpha_func);
404 trace_dump_member(uint, state, alpha_src_factor);
405 trace_dump_member(uint, state, alpha_dst_factor);
406
407 trace_dump_member(uint, state, colormask);
408
409 trace_dump_struct_end();
410 }
411
trace_dump_blend_state(const struct pipe_blend_state * state)412 void trace_dump_blend_state(const struct pipe_blend_state *state)
413 {
414 unsigned valid_entries = 1;
415
416 if (!trace_dumping_enabled_locked())
417 return;
418
419 if (!state) {
420 trace_dump_null();
421 return;
422 }
423
424 trace_dump_struct_begin("pipe_blend_state");
425
426 trace_dump_member(bool, state, dither);
427
428 trace_dump_member(bool, state, logicop_enable);
429 trace_dump_member(uint, state, logicop_func);
430
431 trace_dump_member(bool, state, independent_blend_enable);
432
433 trace_dump_member_begin("rt");
434 if (state->independent_blend_enable)
435 valid_entries = state->max_rt + 1;
436 trace_dump_struct_array(rt_blend_state, state->rt, valid_entries);
437 trace_dump_member_end();
438
439 trace_dump_struct_end();
440 }
441
442
trace_dump_blend_color(const struct pipe_blend_color * state)443 void trace_dump_blend_color(const struct pipe_blend_color *state)
444 {
445 if (!trace_dumping_enabled_locked())
446 return;
447
448 if (!state) {
449 trace_dump_null();
450 return;
451 }
452
453 trace_dump_struct_begin("pipe_blend_color");
454
455 trace_dump_member_array(float, state, color);
456
457 trace_dump_struct_end();
458 }
459
trace_dump_stencil_ref(const struct pipe_stencil_ref * state)460 void trace_dump_stencil_ref(const struct pipe_stencil_ref *state)
461 {
462 if (!trace_dumping_enabled_locked())
463 return;
464
465 if (!state) {
466 trace_dump_null();
467 return;
468 }
469
470 trace_dump_struct_begin("pipe_stencil_ref");
471
472 trace_dump_member_array(uint, state, ref_value);
473
474 trace_dump_struct_end();
475 }
476
trace_dump_framebuffer_state(const struct pipe_framebuffer_state * state)477 void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state)
478 {
479 if (!trace_dumping_enabled_locked())
480 return;
481
482 trace_dump_struct_begin("pipe_framebuffer_state");
483
484 trace_dump_member(uint, state, width);
485 trace_dump_member(uint, state, height);
486 trace_dump_member(uint, state, samples);
487 trace_dump_member(uint, state, layers);
488 trace_dump_member(uint, state, nr_cbufs);
489 trace_dump_member_array(ptr, state, cbufs);
490 trace_dump_member(ptr, state, zsbuf);
491
492 trace_dump_struct_end();
493 }
494
495
trace_dump_sampler_state(const struct pipe_sampler_state * state)496 void trace_dump_sampler_state(const struct pipe_sampler_state *state)
497 {
498 if (!trace_dumping_enabled_locked())
499 return;
500
501 if (!state) {
502 trace_dump_null();
503 return;
504 }
505
506 trace_dump_struct_begin("pipe_sampler_state");
507
508 trace_dump_member(uint, state, wrap_s);
509 trace_dump_member(uint, state, wrap_t);
510 trace_dump_member(uint, state, wrap_r);
511 trace_dump_member(uint, state, min_img_filter);
512 trace_dump_member(uint, state, min_mip_filter);
513 trace_dump_member(uint, state, mag_img_filter);
514 trace_dump_member(uint, state, compare_mode);
515 trace_dump_member(uint, state, compare_func);
516 trace_dump_member(bool, state, normalized_coords);
517 trace_dump_member(uint, state, max_anisotropy);
518 trace_dump_member(bool, state, seamless_cube_map);
519 trace_dump_member(float, state, lod_bias);
520 trace_dump_member(float, state, min_lod);
521 trace_dump_member(float, state, max_lod);
522 trace_dump_member_array(float, state, border_color.f);
523
524 trace_dump_struct_end();
525 }
526
527
trace_dump_sampler_view_template(const struct pipe_sampler_view * state,enum pipe_texture_target target)528 void trace_dump_sampler_view_template(const struct pipe_sampler_view *state,
529 enum pipe_texture_target target)
530 {
531 if (!trace_dumping_enabled_locked())
532 return;
533
534 if (!state) {
535 trace_dump_null();
536 return;
537 }
538
539 trace_dump_struct_begin("pipe_sampler_view");
540
541 trace_dump_member(format, state, format);
542
543 trace_dump_member_begin("u");
544 trace_dump_struct_begin(""); /* anonymous */
545 if (target == PIPE_BUFFER) {
546 trace_dump_member_begin("buf");
547 trace_dump_struct_begin(""); /* anonymous */
548 trace_dump_member(uint, &state->u.buf, offset);
549 trace_dump_member(uint, &state->u.buf, size);
550 trace_dump_struct_end(); /* anonymous */
551 trace_dump_member_end(); /* buf */
552 } else {
553 trace_dump_member_begin("tex");
554 trace_dump_struct_begin(""); /* anonymous */
555 trace_dump_member(uint, &state->u.tex, first_layer);
556 trace_dump_member(uint, &state->u.tex, last_layer);
557 trace_dump_member(uint, &state->u.tex, first_level);
558 trace_dump_member(uint, &state->u.tex, last_level);
559 trace_dump_struct_end(); /* anonymous */
560 trace_dump_member_end(); /* tex */
561 }
562 trace_dump_struct_end(); /* anonymous */
563 trace_dump_member_end(); /* u */
564
565 trace_dump_member(uint, state, swizzle_r);
566 trace_dump_member(uint, state, swizzle_g);
567 trace_dump_member(uint, state, swizzle_b);
568 trace_dump_member(uint, state, swizzle_a);
569
570 trace_dump_struct_end();
571 }
572
573
trace_dump_surface_template(const struct pipe_surface * state,enum pipe_texture_target target)574 void trace_dump_surface_template(const struct pipe_surface *state,
575 enum pipe_texture_target target)
576 {
577 if (!trace_dumping_enabled_locked())
578 return;
579
580 if (!state) {
581 trace_dump_null();
582 return;
583 }
584
585 trace_dump_struct_begin("pipe_surface");
586
587 trace_dump_member(format, state, format);
588 trace_dump_member(uint, state, width);
589 trace_dump_member(uint, state, height);
590
591 trace_dump_member_begin("u");
592 trace_dump_struct_begin(""); /* anonymous */
593 if (target == PIPE_BUFFER) {
594 trace_dump_member_begin("buf");
595 trace_dump_struct_begin(""); /* anonymous */
596 trace_dump_member(uint, &state->u.buf, first_element);
597 trace_dump_member(uint, &state->u.buf, last_element);
598 trace_dump_struct_end(); /* anonymous */
599 trace_dump_member_end(); /* buf */
600 } else {
601 trace_dump_member_begin("tex");
602 trace_dump_struct_begin(""); /* anonymous */
603 trace_dump_member(uint, &state->u.tex, level);
604 trace_dump_member(uint, &state->u.tex, first_layer);
605 trace_dump_member(uint, &state->u.tex, last_layer);
606 trace_dump_struct_end(); /* anonymous */
607 trace_dump_member_end(); /* tex */
608 }
609 trace_dump_struct_end(); /* anonymous */
610 trace_dump_member_end(); /* u */
611
612 trace_dump_struct_end();
613 }
614
615
trace_dump_transfer(const struct pipe_transfer * state)616 void trace_dump_transfer(const struct pipe_transfer *state)
617 {
618 if (!trace_dumping_enabled_locked())
619 return;
620
621 if (!state) {
622 trace_dump_null();
623 return;
624 }
625
626 trace_dump_struct_begin("pipe_transfer");
627
628 trace_dump_member(uint, state, box.x);
629 trace_dump_member(uint, state, box.y);
630 trace_dump_member(uint, state, box.z);
631 trace_dump_member(uint, state, box.width);
632 trace_dump_member(uint, state, box.height);
633 trace_dump_member(uint, state, box.depth);
634
635 trace_dump_member(uint, state, stride);
636 trace_dump_member(uint, state, layer_stride);
637 trace_dump_member(uint, state, usage);
638
639 trace_dump_member(ptr, state, resource);
640
641 trace_dump_struct_end();
642 }
643
644
trace_dump_vertex_buffer(const struct pipe_vertex_buffer * state)645 void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state)
646 {
647 if (!trace_dumping_enabled_locked())
648 return;
649
650 if (!state) {
651 trace_dump_null();
652 return;
653 }
654
655 trace_dump_struct_begin("pipe_vertex_buffer");
656
657 trace_dump_member(uint, state, stride);
658 trace_dump_member(bool, state, is_user_buffer);
659 trace_dump_member(uint, state, buffer_offset);
660 trace_dump_member(ptr, state, buffer.resource);
661
662 trace_dump_struct_end();
663 }
664
665
trace_dump_vertex_element(const struct pipe_vertex_element * state)666 void trace_dump_vertex_element(const struct pipe_vertex_element *state)
667 {
668 if (!trace_dumping_enabled_locked())
669 return;
670
671 if (!state) {
672 trace_dump_null();
673 return;
674 }
675
676 trace_dump_struct_begin("pipe_vertex_element");
677
678 trace_dump_member(uint, state, src_offset);
679
680 trace_dump_member(uint, state, vertex_buffer_index);
681
682 trace_dump_member(format, state, src_format);
683
684 trace_dump_struct_end();
685 }
686
687
trace_dump_constant_buffer(const struct pipe_constant_buffer * state)688 void trace_dump_constant_buffer(const struct pipe_constant_buffer *state)
689 {
690 if (!trace_dumping_enabled_locked())
691 return;
692
693 if (!state) {
694 trace_dump_null();
695 return;
696 }
697
698 trace_dump_struct_begin("pipe_constant_buffer");
699 trace_dump_member(ptr, state, buffer);
700 trace_dump_member(uint, state, buffer_offset);
701 trace_dump_member(uint, state, buffer_size);
702 trace_dump_struct_end();
703 }
704
705
trace_dump_shader_buffer(const struct pipe_shader_buffer * state)706 void trace_dump_shader_buffer(const struct pipe_shader_buffer *state)
707 {
708 if (!trace_dumping_enabled_locked())
709 return;
710
711 if(!state) {
712 trace_dump_null();
713 return;
714 }
715
716 trace_dump_struct_begin("pipe_shader_buffer");
717 trace_dump_member(ptr, state, buffer);
718 trace_dump_member(uint, state, buffer_offset);
719 trace_dump_member(uint, state, buffer_size);
720 trace_dump_struct_end();
721 }
722
723
trace_dump_image_view(const struct pipe_image_view * state)724 void trace_dump_image_view(const struct pipe_image_view *state)
725 {
726 if (!trace_dumping_enabled_locked())
727 return;
728
729 if (!state || !state->resource) {
730 trace_dump_null();
731 return;
732 }
733
734 trace_dump_struct_begin("pipe_image_view");
735 trace_dump_member(ptr, state, resource);
736 trace_dump_member(uint, state, format);
737 trace_dump_member(uint, state, access);
738
739 trace_dump_member_begin("u");
740 trace_dump_struct_begin(""); /* anonymous */
741 if (state->resource->target == PIPE_BUFFER) {
742 trace_dump_member_begin("buf");
743 trace_dump_struct_begin(""); /* anonymous */
744 trace_dump_member(uint, &state->u.buf, offset);
745 trace_dump_member(uint, &state->u.buf, size);
746 trace_dump_struct_end(); /* anonymous */
747 trace_dump_member_end(); /* buf */
748 } else {
749 trace_dump_member_begin("tex");
750 trace_dump_struct_begin(""); /* anonymous */
751 trace_dump_member(uint, &state->u.tex, first_layer);
752 trace_dump_member(uint, &state->u.tex, last_layer);
753 trace_dump_member(uint, &state->u.tex, level);
754 trace_dump_struct_end(); /* anonymous */
755 trace_dump_member_end(); /* tex */
756 }
757 trace_dump_struct_end(); /* anonymous */
758 trace_dump_member_end(); /* u */
759
760 trace_dump_struct_end();
761 }
762
763
trace_dump_draw_info(const struct pipe_draw_info * state)764 void trace_dump_draw_info(const struct pipe_draw_info *state)
765 {
766 if (!trace_dumping_enabled_locked())
767 return;
768
769 if (!state) {
770 trace_dump_null();
771 return;
772 }
773
774 trace_dump_struct_begin("pipe_draw_info");
775
776 trace_dump_member(uint, state, index_size);
777 trace_dump_member(uint, state, has_user_indices);
778
779 trace_dump_member(uint, state, mode);
780 trace_dump_member(uint, state, start);
781 trace_dump_member(uint, state, count);
782
783 trace_dump_member(uint, state, start_instance);
784 trace_dump_member(uint, state, instance_count);
785
786 trace_dump_member(uint, state, vertices_per_patch);
787
788 trace_dump_member(int, state, index_bias);
789 trace_dump_member(uint, state, min_index);
790 trace_dump_member(uint, state, max_index);
791
792 trace_dump_member(bool, state, primitive_restart);
793 trace_dump_member(uint, state, restart_index);
794
795 trace_dump_member(ptr, state, index.resource);
796 trace_dump_member(ptr, state, count_from_stream_output);
797
798 if (!state->indirect) {
799 trace_dump_member(ptr, state, indirect);
800 } else {
801 trace_dump_member(uint, state, indirect->offset);
802 trace_dump_member(uint, state, indirect->stride);
803 trace_dump_member(uint, state, indirect->draw_count);
804 trace_dump_member(uint, state, indirect->indirect_draw_count_offset);
805 trace_dump_member(ptr, state, indirect->buffer);
806 trace_dump_member(ptr, state, indirect->indirect_draw_count);
807 }
808
809 trace_dump_struct_end();
810 }
811
trace_dump_blit_info(const struct pipe_blit_info * info)812 void trace_dump_blit_info(const struct pipe_blit_info *info)
813 {
814 char mask[7];
815
816 if (!trace_dumping_enabled_locked())
817 return;
818
819 if (!info) {
820 trace_dump_null();
821 return;
822 }
823
824 trace_dump_struct_begin("pipe_blit_info");
825
826 trace_dump_member_begin("dst");
827 trace_dump_struct_begin("dst");
828 trace_dump_member(ptr, &info->dst, resource);
829 trace_dump_member(uint, &info->dst, level);
830 trace_dump_member(format, &info->dst, format);
831 trace_dump_member_begin("box");
832 trace_dump_box(&info->dst.box);
833 trace_dump_member_end();
834 trace_dump_struct_end();
835 trace_dump_member_end();
836
837 trace_dump_member_begin("src");
838 trace_dump_struct_begin("src");
839 trace_dump_member(ptr, &info->src, resource);
840 trace_dump_member(uint, &info->src, level);
841 trace_dump_member(format, &info->src, format);
842 trace_dump_member_begin("box");
843 trace_dump_box(&info->src.box);
844 trace_dump_member_end();
845 trace_dump_struct_end();
846 trace_dump_member_end();
847
848 mask[0] = (info->mask & PIPE_MASK_R) ? 'R' : '-';
849 mask[1] = (info->mask & PIPE_MASK_G) ? 'G' : '-';
850 mask[2] = (info->mask & PIPE_MASK_B) ? 'B' : '-';
851 mask[3] = (info->mask & PIPE_MASK_A) ? 'A' : '-';
852 mask[4] = (info->mask & PIPE_MASK_Z) ? 'Z' : '-';
853 mask[5] = (info->mask & PIPE_MASK_S) ? 'S' : '-';
854 mask[6] = 0;
855
856 trace_dump_member_begin("mask");
857 trace_dump_string(mask);
858 trace_dump_member_end();
859 trace_dump_member(uint, info, filter);
860
861 trace_dump_member(bool, info, scissor_enable);
862 trace_dump_member_begin("scissor");
863 trace_dump_scissor_state(&info->scissor);
864 trace_dump_member_end();
865
866 trace_dump_struct_end();
867 }
868
869 void
trace_dump_query_result(unsigned query_type,const union pipe_query_result * result)870 trace_dump_query_result(unsigned query_type,
871 const union pipe_query_result *result)
872 {
873 if (!trace_dumping_enabled_locked())
874 return;
875
876 if (!result) {
877 trace_dump_null();
878 return;
879 }
880
881 switch (query_type) {
882 case PIPE_QUERY_OCCLUSION_PREDICATE:
883 case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
884 case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
885 case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE:
886 case PIPE_QUERY_GPU_FINISHED:
887 trace_dump_bool(result->b);
888 break;
889
890 case PIPE_QUERY_OCCLUSION_COUNTER:
891 case PIPE_QUERY_TIMESTAMP:
892 case PIPE_QUERY_TIME_ELAPSED:
893 case PIPE_QUERY_PRIMITIVES_GENERATED:
894 case PIPE_QUERY_PRIMITIVES_EMITTED:
895 trace_dump_uint(result->u64);
896 break;
897
898 case PIPE_QUERY_SO_STATISTICS:
899 trace_dump_struct_begin("pipe_query_data_so_statistics");
900 trace_dump_member(uint, &result->so_statistics, num_primitives_written);
901 trace_dump_member(uint, &result->so_statistics, primitives_storage_needed);
902 trace_dump_struct_end();
903 break;
904
905 case PIPE_QUERY_TIMESTAMP_DISJOINT:
906 trace_dump_struct_begin("pipe_query_data_timestamp_disjoint");
907 trace_dump_member(uint, &result->timestamp_disjoint, frequency);
908 trace_dump_member(bool, &result->timestamp_disjoint, disjoint);
909 trace_dump_struct_end();
910 break;
911
912 case PIPE_QUERY_PIPELINE_STATISTICS:
913 trace_dump_struct_begin("pipe_query_data_pipeline_statistics");
914 trace_dump_member(uint, &result->pipeline_statistics, ia_vertices);
915 trace_dump_member(uint, &result->pipeline_statistics, ia_primitives);
916 trace_dump_member(uint, &result->pipeline_statistics, vs_invocations);
917 trace_dump_member(uint, &result->pipeline_statistics, gs_invocations);
918 trace_dump_member(uint, &result->pipeline_statistics, gs_primitives);
919 trace_dump_member(uint, &result->pipeline_statistics, c_invocations);
920 trace_dump_member(uint, &result->pipeline_statistics, c_primitives);
921 trace_dump_member(uint, &result->pipeline_statistics, ps_invocations);
922 trace_dump_member(uint, &result->pipeline_statistics, hs_invocations);
923 trace_dump_member(uint, &result->pipeline_statistics, ds_invocations);
924 trace_dump_member(uint, &result->pipeline_statistics, cs_invocations);
925 trace_dump_struct_end();
926 break;
927
928 default:
929 assert(query_type >= PIPE_QUERY_DRIVER_SPECIFIC);
930 trace_dump_uint(result->u64);
931 break;
932 }
933 }
934
trace_dump_grid_info(const struct pipe_grid_info * state)935 void trace_dump_grid_info(const struct pipe_grid_info *state)
936 {
937 if (!trace_dumping_enabled_locked())
938 return;
939
940 if (!state) {
941 trace_dump_null();
942 return;
943 }
944
945 trace_dump_struct_begin("pipe_grid_info");
946
947 trace_dump_member(uint, state, pc);
948 trace_dump_member(ptr, state, input);
949
950 trace_dump_member_begin("block");
951 trace_dump_array(uint, state->block, ARRAY_SIZE(state->block));
952 trace_dump_member_end();
953
954 trace_dump_member_begin("grid");
955 trace_dump_array(uint, state->grid, ARRAY_SIZE(state->grid));
956 trace_dump_member_end();
957
958 trace_dump_member(ptr, state, indirect);
959 trace_dump_member(uint, state, indirect_offset);
960
961 trace_dump_struct_end();
962 }
963
964