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