1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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 TUNGSTEN GRAPHICS 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.
26 **************************************************************************/
29 #include "pipe/p_compiler.h"
30 #include "util/u_memory.h"
31 #include "tgsi/tgsi_dump.h"
34 #include "tr_dump_state.h"
37 void trace_dump_format(enum pipe_format format
)
39 if (!trace_dumping_enabled_locked())
42 trace_dump_enum(pf_name(format
) );
46 static void trace_dump_reference(const struct pipe_reference
*reference
)
48 if (!trace_dumping_enabled_locked())
51 trace_dump_struct_begin("pipe_reference");
52 trace_dump_member(int, &reference
->count
, count
);
53 trace_dump_struct_end();
57 void trace_dump_template(const struct pipe_texture
*templat
)
59 if (!trace_dumping_enabled_locked())
67 trace_dump_struct_begin("pipe_texture");
69 trace_dump_member(int, templat
, target
);
70 trace_dump_member(format
, templat
, format
);
72 trace_dump_member_begin("width");
73 trace_dump_uint(templat
->width0
);
74 trace_dump_member_end();
76 trace_dump_member_begin("height");
77 trace_dump_uint(templat
->height0
);
78 trace_dump_member_end();
80 trace_dump_member_begin("depth");
81 trace_dump_uint(templat
->depth0
);
82 trace_dump_member_end();
84 trace_dump_member(uint
, templat
, last_level
);
85 trace_dump_member(uint
, templat
, tex_usage
);
87 trace_dump_struct_end();
91 void trace_dump_rasterizer_state(const struct pipe_rasterizer_state
*state
)
93 if (!trace_dumping_enabled_locked())
101 trace_dump_struct_begin("pipe_rasterizer_state");
103 trace_dump_member(bool, state
, flatshade
);
104 trace_dump_member(bool, state
, light_twoside
);
105 trace_dump_member(uint
, state
, front_winding
);
106 trace_dump_member(uint
, state
, cull_mode
);
107 trace_dump_member(uint
, state
, fill_cw
);
108 trace_dump_member(uint
, state
, fill_ccw
);
109 trace_dump_member(bool, state
, offset_cw
);
110 trace_dump_member(bool, state
, offset_ccw
);
111 trace_dump_member(bool, state
, scissor
);
112 trace_dump_member(bool, state
, poly_smooth
);
113 trace_dump_member(bool, state
, poly_stipple_enable
);
114 trace_dump_member(bool, state
, point_smooth
);
115 trace_dump_member(bool, state
, point_sprite
);
116 trace_dump_member(bool, state
, point_size_per_vertex
);
117 trace_dump_member(bool, state
, multisample
);
118 trace_dump_member(bool, state
, line_smooth
);
119 trace_dump_member(bool, state
, line_stipple_enable
);
120 trace_dump_member(uint
, state
, line_stipple_factor
);
121 trace_dump_member(uint
, state
, line_stipple_pattern
);
122 trace_dump_member(bool, state
, line_last_pixel
);
123 trace_dump_member(bool, state
, bypass_vs_clip_and_viewport
);
124 trace_dump_member(bool, state
, flatshade_first
);
125 trace_dump_member(bool, state
, gl_rasterization_rules
);
127 trace_dump_member(float, state
, line_width
);
128 trace_dump_member(float, state
, point_size
);
129 trace_dump_member(float, state
, point_size_min
);
130 trace_dump_member(float, state
, point_size_max
);
131 trace_dump_member(float, state
, offset_units
);
132 trace_dump_member(float, state
, offset_scale
);
134 trace_dump_member_array(uint
, state
, sprite_coord_mode
);
136 trace_dump_struct_end();
140 void trace_dump_poly_stipple(const struct pipe_poly_stipple
*state
)
142 if (!trace_dumping_enabled_locked())
150 trace_dump_struct_begin("pipe_poly_stipple");
152 trace_dump_member_begin("stipple");
153 trace_dump_array(uint
,
155 Elements(state
->stipple
));
156 trace_dump_member_end();
158 trace_dump_struct_end();
162 void trace_dump_viewport_state(const struct pipe_viewport_state
*state
)
164 if (!trace_dumping_enabled_locked())
172 trace_dump_struct_begin("pipe_viewport_state");
174 trace_dump_member_array(float, state
, scale
);
175 trace_dump_member_array(float, state
, translate
);
177 trace_dump_struct_end();
181 void trace_dump_scissor_state(const struct pipe_scissor_state
*state
)
183 if (!trace_dumping_enabled_locked())
191 trace_dump_struct_begin("pipe_scissor_state");
193 trace_dump_member(uint
, state
, minx
);
194 trace_dump_member(uint
, state
, miny
);
195 trace_dump_member(uint
, state
, maxx
);
196 trace_dump_member(uint
, state
, maxy
);
198 trace_dump_struct_end();
202 void trace_dump_clip_state(const struct pipe_clip_state
*state
)
206 if (!trace_dumping_enabled_locked())
214 trace_dump_struct_begin("pipe_clip_state");
216 trace_dump_member_begin("ucp");
217 trace_dump_array_begin();
218 for(i
= 0; i
< PIPE_MAX_CLIP_PLANES
; ++i
) {
219 trace_dump_elem_begin();
220 trace_dump_array(float, state
->ucp
[i
], 4);
221 trace_dump_elem_end();
223 trace_dump_array_end();
224 trace_dump_member_end();
226 trace_dump_member(uint
, state
, nr
);
228 trace_dump_struct_end();
232 void trace_dump_constant_buffer(const struct pipe_constant_buffer
*state
)
234 if (!trace_dumping_enabled_locked())
242 trace_dump_struct_begin("pipe_constant_buffer");
244 trace_dump_member(buffer_ptr
, state
, buffer
);
246 trace_dump_struct_end();
250 void trace_dump_shader_state(const struct pipe_shader_state
*state
)
252 static char str
[8192];
254 if (!trace_dumping_enabled_locked())
262 tgsi_dump_str(state
->tokens
, 0, str
, sizeof(str
));
264 trace_dump_struct_begin("pipe_shader_state");
266 trace_dump_member_begin("tokens");
267 trace_dump_string(str
);
268 trace_dump_member_end();
270 trace_dump_struct_end();
274 void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state
*state
)
278 if (!trace_dumping_enabled_locked())
286 trace_dump_struct_begin("pipe_depth_stencil_alpha_state");
288 trace_dump_member_begin("depth");
289 trace_dump_struct_begin("pipe_depth_state");
290 trace_dump_member(bool, &state
->depth
, enabled
);
291 trace_dump_member(bool, &state
->depth
, writemask
);
292 trace_dump_member(uint
, &state
->depth
, func
);
293 trace_dump_struct_end();
294 trace_dump_member_end();
296 trace_dump_member_begin("stencil");
297 trace_dump_array_begin();
298 for(i
= 0; i
< Elements(state
->stencil
); ++i
) {
299 trace_dump_elem_begin();
300 trace_dump_struct_begin("pipe_stencil_state");
301 trace_dump_member(bool, &state
->stencil
[i
], enabled
);
302 trace_dump_member(uint
, &state
->stencil
[i
], func
);
303 trace_dump_member(uint
, &state
->stencil
[i
], fail_op
);
304 trace_dump_member(uint
, &state
->stencil
[i
], zpass_op
);
305 trace_dump_member(uint
, &state
->stencil
[i
], zfail_op
);
306 trace_dump_member(uint
, &state
->stencil
[i
], ref_value
);
307 trace_dump_member(uint
, &state
->stencil
[i
], valuemask
);
308 trace_dump_member(uint
, &state
->stencil
[i
], writemask
);
309 trace_dump_struct_end();
310 trace_dump_elem_end();
312 trace_dump_array_end();
313 trace_dump_member_end();
315 trace_dump_member_begin("alpha");
316 trace_dump_struct_begin("pipe_alpha_state");
317 trace_dump_member(bool, &state
->alpha
, enabled
);
318 trace_dump_member(uint
, &state
->alpha
, func
);
319 trace_dump_member(float, &state
->alpha
, ref_value
);
320 trace_dump_struct_end();
321 trace_dump_member_end();
323 trace_dump_struct_end();
327 void trace_dump_blend_state(const struct pipe_blend_state
*state
)
329 if (!trace_dumping_enabled_locked())
337 trace_dump_struct_begin("pipe_blend_state");
339 trace_dump_member(bool, state
, blend_enable
);
341 trace_dump_member(uint
, state
, rgb_func
);
342 trace_dump_member(uint
, state
, rgb_src_factor
);
343 trace_dump_member(uint
, state
, rgb_dst_factor
);
345 trace_dump_member(uint
, state
, alpha_func
);
346 trace_dump_member(uint
, state
, alpha_src_factor
);
347 trace_dump_member(uint
, state
, alpha_dst_factor
);
349 trace_dump_member(bool, state
, logicop_enable
);
350 trace_dump_member(uint
, state
, logicop_func
);
352 trace_dump_member(uint
, state
, colormask
);
353 trace_dump_member(bool, state
, dither
);
355 trace_dump_struct_end();
359 void trace_dump_blend_color(const struct pipe_blend_color
*state
)
361 if (!trace_dumping_enabled_locked())
369 trace_dump_struct_begin("pipe_blend_color");
371 trace_dump_member_array(float, state
, color
);
373 trace_dump_struct_end();
377 void trace_dump_framebuffer_state(const struct pipe_framebuffer_state
*state
)
379 if (!trace_dumping_enabled_locked())
382 trace_dump_struct_begin("pipe_framebuffer_state");
384 trace_dump_member(uint
, state
, width
);
385 trace_dump_member(uint
, state
, height
);
386 trace_dump_member(uint
, state
, nr_cbufs
);
387 trace_dump_member_array(ptr
, state
, cbufs
);
388 trace_dump_member(ptr
, state
, zsbuf
);
390 trace_dump_struct_end();
394 void trace_dump_sampler_state(const struct pipe_sampler_state
*state
)
396 if (!trace_dumping_enabled_locked())
404 trace_dump_struct_begin("pipe_sampler_state");
406 trace_dump_member(uint
, state
, wrap_s
);
407 trace_dump_member(uint
, state
, wrap_t
);
408 trace_dump_member(uint
, state
, wrap_r
);
409 trace_dump_member(uint
, state
, min_img_filter
);
410 trace_dump_member(uint
, state
, min_mip_filter
);
411 trace_dump_member(uint
, state
, mag_img_filter
);
412 trace_dump_member(bool, state
, compare_mode
);
413 trace_dump_member(uint
, state
, compare_func
);
414 trace_dump_member(bool, state
, normalized_coords
);
415 trace_dump_member(uint
, state
, prefilter
);
416 trace_dump_member(float, state
, lod_bias
);
417 trace_dump_member(float, state
, min_lod
);
418 trace_dump_member(float, state
, max_lod
);
419 trace_dump_member_array(float, state
, border_color
);
420 trace_dump_member(float, state
, max_anisotropy
);
422 trace_dump_struct_end();
426 void trace_dump_surface(const struct pipe_surface
*state
)
428 if (!trace_dumping_enabled_locked())
436 trace_dump_struct_begin("pipe_surface");
438 trace_dump_reference(&state
->reference
);
440 trace_dump_member(format
, state
, format
);
441 trace_dump_member(uint
, state
, width
);
442 trace_dump_member(uint
, state
, height
);
444 trace_dump_member(uint
, state
, layout
);
445 trace_dump_member(uint
, state
, offset
);
446 trace_dump_member(uint
, state
, usage
);
448 trace_dump_member(ptr
, state
, texture
);
449 trace_dump_member(uint
, state
, face
);
450 trace_dump_member(uint
, state
, level
);
451 trace_dump_member(uint
, state
, zslice
);
453 trace_dump_struct_end();
457 void trace_dump_transfer(const struct pipe_transfer
*state
)
459 if (!trace_dumping_enabled_locked())
467 trace_dump_struct_begin("pipe_transfer");
469 trace_dump_member(uint
, state
, width
);
470 trace_dump_member(uint
, state
, height
);
472 trace_dump_member(uint
, state
, stride
);
473 trace_dump_member(uint
, state
, usage
);
475 trace_dump_member(ptr
, state
, texture
);
476 trace_dump_member(uint
, state
, face
);
477 trace_dump_member(uint
, state
, level
);
478 trace_dump_member(uint
, state
, zslice
);
480 trace_dump_struct_end();
484 void trace_dump_vertex_buffer(const struct pipe_vertex_buffer
*state
)
486 if (!trace_dumping_enabled_locked())
494 trace_dump_struct_begin("pipe_vertex_buffer");
496 trace_dump_member(uint
, state
, stride
);
497 trace_dump_member(uint
, state
, max_index
);
498 trace_dump_member(uint
, state
, buffer_offset
);
499 trace_dump_member(buffer_ptr
, state
, buffer
);
501 trace_dump_struct_end();
505 void trace_dump_vertex_element(const struct pipe_vertex_element
*state
)
507 if (!trace_dumping_enabled_locked())
515 trace_dump_struct_begin("pipe_vertex_element");
517 trace_dump_member(uint
, state
, src_offset
);
519 trace_dump_member(uint
, state
, vertex_buffer_index
);
520 trace_dump_member(uint
, state
, nr_components
);
522 trace_dump_member(format
, state
, src_format
);
524 trace_dump_struct_end();