tr_state.c

Go to the documentation of this file.
00001 /**************************************************************************
00002  *
00003  * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
00004  * All Rights Reserved.
00005  *
00006  * Permission is hereby granted, free of charge, to any person obtaining a
00007  * copy of this software and associated documentation files (the
00008  * "Software"), to deal in the Software without restriction, including
00009  * without limitation the rights to use, copy, modify, merge, publish,
00010  * distribute, sub license, and/or sell copies of the Software, and to
00011  * permit persons to whom the Software is furnished to do so, subject to
00012  * the following conditions:
00013  *
00014  * The above copyright notice and this permission notice (including the
00015  * next paragraph) shall be included in all copies or substantial portions
00016  * of the Software.
00017  *
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
00021  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
00022  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00023  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00024  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00025  *
00026  **************************************************************************/
00027 
00028 
00029 #include "pipe/p_compiler.h"
00030 #include "util/u_memory.h"
00031 #include "tgsi/tgsi_dump.h"
00032 
00033 #include "tr_dump.h"
00034 #include "tr_state.h"
00035 
00036 
00037 void trace_dump_format(enum pipe_format format)
00038 {
00039    trace_dump_enum(pf_name(format) );
00040 }
00041 
00042 
00043 void trace_dump_block(const struct pipe_format_block *block)
00044 {
00045    trace_dump_struct_begin("pipe_format_block");
00046    trace_dump_member(uint, block, size);
00047    trace_dump_member(uint, block, width);
00048    trace_dump_member(uint, block, height);
00049    trace_dump_struct_end();
00050 }
00051 
00052 
00053 void trace_dump_template(const struct pipe_texture *templat)
00054 {
00055    if(!templat) {
00056       trace_dump_null();
00057       return;
00058    }
00059 
00060    trace_dump_struct_begin("pipe_texture");
00061    
00062    trace_dump_member(int, templat, target);
00063    trace_dump_member(format, templat, format);
00064    
00065    trace_dump_member_begin("width");
00066    trace_dump_array(uint, templat->width, 1);
00067    trace_dump_member_end();
00068 
00069    trace_dump_member_begin("height");
00070    trace_dump_array(uint, templat->height, 1);
00071    trace_dump_member_end();
00072 
00073    trace_dump_member_begin("depth");
00074    trace_dump_array(uint, templat->depth, 1);
00075    trace_dump_member_end();
00076 
00077    trace_dump_member_begin("block");
00078    trace_dump_block(&templat->block);
00079    trace_dump_member_end();
00080    
00081    trace_dump_member(uint, templat, last_level);
00082    trace_dump_member(uint, templat, tex_usage);
00083    
00084    trace_dump_struct_end();
00085 }
00086 
00087 
00088 void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state)
00089 {
00090    if(!state) {
00091       trace_dump_null();
00092       return;
00093    }
00094 
00095    trace_dump_struct_begin("pipe_rasterizer_state");
00096 
00097    trace_dump_member(bool, state, flatshade);
00098    trace_dump_member(bool, state, light_twoside);
00099    trace_dump_member(uint, state, front_winding);
00100    trace_dump_member(uint, state, cull_mode);
00101    trace_dump_member(uint, state, fill_cw);
00102    trace_dump_member(uint, state, fill_ccw);
00103    trace_dump_member(bool, state, offset_cw);
00104    trace_dump_member(bool, state, offset_ccw);
00105    trace_dump_member(bool, state, scissor);
00106    trace_dump_member(bool, state, poly_smooth);
00107    trace_dump_member(bool, state, poly_stipple_enable);
00108    trace_dump_member(bool, state, point_smooth);
00109    trace_dump_member(bool, state, point_sprite);
00110    trace_dump_member(bool, state, point_size_per_vertex);
00111    trace_dump_member(bool, state, multisample);
00112    trace_dump_member(bool, state, line_smooth);
00113    trace_dump_member(bool, state, line_stipple_enable);
00114    trace_dump_member(uint, state, line_stipple_factor);
00115    trace_dump_member(uint, state, line_stipple_pattern);
00116    trace_dump_member(bool, state, line_last_pixel);
00117    trace_dump_member(bool, state, bypass_clipping);
00118    trace_dump_member(bool, state, bypass_vs);
00119    trace_dump_member(bool, state, origin_lower_left);
00120    trace_dump_member(bool, state, flatshade_first);
00121    trace_dump_member(bool, state, gl_rasterization_rules);
00122 
00123    trace_dump_member(float, state, line_width);
00124    trace_dump_member(float, state, point_size);
00125    trace_dump_member(float, state, point_size_min);
00126    trace_dump_member(float, state, point_size_max);
00127    trace_dump_member(float, state, offset_units);
00128    trace_dump_member(float, state, offset_scale);
00129    
00130    trace_dump_member_array(uint, state, sprite_coord_mode);
00131    
00132    trace_dump_struct_end();
00133 }
00134 
00135 
00136 void trace_dump_poly_stipple(const struct pipe_poly_stipple *state)
00137 {
00138    if(!state) {
00139       trace_dump_null();
00140       return;
00141    }
00142 
00143    trace_dump_struct_begin("pipe_poly_stipple");
00144 
00145    trace_dump_member_begin("stipple");
00146    trace_dump_array(uint,
00147                     state->stipple, 
00148                     Elements(state->stipple));
00149    trace_dump_member_end();
00150    
00151    trace_dump_struct_end();
00152 }
00153 
00154 
00155 void trace_dump_viewport_state(const struct pipe_viewport_state *state)
00156 {
00157    if(!state) {
00158       trace_dump_null();
00159       return;
00160    }
00161 
00162    trace_dump_struct_begin("pipe_viewport_state");
00163 
00164    trace_dump_member_array(float, state, scale);
00165    trace_dump_member_array(float, state, translate);
00166    
00167    trace_dump_struct_end();
00168 }
00169 
00170 
00171 void trace_dump_scissor_state(const struct pipe_scissor_state *state)
00172 {
00173    if(!state) {
00174       trace_dump_null();
00175       return;
00176    }
00177 
00178    trace_dump_struct_begin("pipe_scissor_state");
00179 
00180    trace_dump_member(uint, state, minx);
00181    trace_dump_member(uint, state, miny);
00182    trace_dump_member(uint, state, maxx);
00183    trace_dump_member(uint, state, maxy);
00184 
00185    trace_dump_struct_end();
00186 }
00187 
00188 
00189 void trace_dump_clip_state(const struct pipe_clip_state *state)
00190 {
00191    unsigned i;
00192    
00193    if(!state) {
00194       trace_dump_null();
00195       return;
00196    }
00197 
00198    trace_dump_struct_begin("pipe_clip_state");
00199 
00200    trace_dump_member_begin("ucp");
00201    trace_dump_array_begin();
00202    for(i = 0; i < PIPE_MAX_CLIP_PLANES; ++i) {
00203       trace_dump_elem_begin();
00204       trace_dump_array(float, state->ucp[i], 4);
00205       trace_dump_elem_end();
00206    }
00207    trace_dump_array_end();
00208    trace_dump_member_end();
00209 
00210    trace_dump_member(uint, state, nr);
00211 
00212    trace_dump_struct_end();
00213 }
00214 
00215 
00216 void trace_dump_constant_buffer(const struct pipe_constant_buffer *state)
00217 {
00218    if(!state) {
00219       trace_dump_null();
00220       return;
00221    }
00222 
00223    trace_dump_struct_begin("pipe_constant_buffer");
00224 
00225    trace_dump_member(ptr, state, buffer);
00226    trace_dump_member(uint, state, size);
00227 
00228    trace_dump_struct_end();
00229 }
00230 
00231 
00232 void trace_dump_shader_state(const struct pipe_shader_state *state)
00233 {
00234    static char str[8192];
00235 
00236    if(!state) {
00237       trace_dump_null();
00238       return;
00239    }
00240 
00241    tgsi_dump_str(state->tokens, 0, str, sizeof(str));
00242    
00243    trace_dump_struct_begin("pipe_shader_state");
00244 
00245    trace_dump_member_begin("tokens");
00246    trace_dump_string(str);
00247    trace_dump_member_end();
00248 
00249    trace_dump_struct_end();
00250 }
00251 
00252 
00253 void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state *state)
00254 {
00255    unsigned i;
00256    
00257    if(!state) {
00258       trace_dump_null();
00259       return;
00260    }
00261 
00262    trace_dump_struct_begin("pipe_depth_stencil_alpha_state");
00263 
00264    trace_dump_member_begin("depth");
00265    trace_dump_struct_begin("pipe_depth_state");
00266    trace_dump_member(bool, &state->depth, enabled);
00267    trace_dump_member(bool, &state->depth, writemask);
00268    trace_dump_member(uint, &state->depth, func);
00269    trace_dump_member(bool, &state->depth, occlusion_count);
00270    trace_dump_struct_end();
00271    trace_dump_member_end();
00272    
00273    trace_dump_member_begin("stencil");
00274    trace_dump_array_begin();
00275    for(i = 0; i < Elements(state->stencil); ++i) {
00276       trace_dump_elem_begin();
00277       trace_dump_struct_begin("pipe_stencil_state");
00278       trace_dump_member(bool, &state->stencil[i], enabled);
00279       trace_dump_member(uint, &state->stencil[i], func);
00280       trace_dump_member(uint, &state->stencil[i], fail_op);
00281       trace_dump_member(uint, &state->stencil[i], zpass_op);
00282       trace_dump_member(uint, &state->stencil[i], zfail_op);
00283       trace_dump_member(uint, &state->stencil[i], ref_value);    
00284       trace_dump_member(uint, &state->stencil[i], value_mask);
00285       trace_dump_member(uint, &state->stencil[i], write_mask);
00286       trace_dump_struct_end();
00287       trace_dump_elem_end();
00288    }
00289    trace_dump_array_end();
00290    trace_dump_member_end();
00291 
00292    trace_dump_member_begin("alpha");
00293    trace_dump_struct_begin("pipe_alpha_state");
00294    trace_dump_member(bool, &state->alpha, enabled);
00295    trace_dump_member(uint, &state->alpha, func);
00296    trace_dump_member(float, &state->alpha, ref);
00297    trace_dump_struct_end();
00298    trace_dump_member_end();
00299 
00300    trace_dump_struct_end();
00301 }
00302 
00303 
00304 void trace_dump_blend_state(const struct pipe_blend_state *state)
00305 {
00306    if(!state) {
00307       trace_dump_null();
00308       return;
00309    }
00310 
00311    trace_dump_struct_begin("pipe_blend_state");
00312 
00313    trace_dump_member(bool, state, blend_enable);
00314 
00315    trace_dump_member(uint, state, rgb_func);
00316    trace_dump_member(uint, state, rgb_src_factor);
00317    trace_dump_member(uint, state, rgb_dst_factor);
00318 
00319    trace_dump_member(uint, state, alpha_func);
00320    trace_dump_member(uint, state, alpha_src_factor);
00321    trace_dump_member(uint, state, alpha_dst_factor);
00322 
00323    trace_dump_member(bool, state, logicop_enable);
00324    trace_dump_member(uint, state, logicop_func);
00325 
00326    trace_dump_member(uint, state, colormask);
00327    trace_dump_member(bool, state, dither);
00328 
00329    trace_dump_struct_end();
00330 }
00331 
00332 
00333 void trace_dump_blend_color(const struct pipe_blend_color *state)
00334 {
00335    if(!state) {
00336       trace_dump_null();
00337       return;
00338    }
00339 
00340    trace_dump_struct_begin("pipe_blend_color");
00341 
00342    trace_dump_member_array(float, state, color);
00343 
00344    trace_dump_struct_end();
00345 }
00346 
00347 
00348 void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state)
00349 {
00350    trace_dump_struct_begin("pipe_framebuffer_state");
00351 
00352    trace_dump_member(uint, state, width);
00353    trace_dump_member(uint, state, height);
00354    trace_dump_member(uint, state, num_cbufs);
00355    trace_dump_member_array(ptr, state, cbufs);
00356    trace_dump_member(ptr, state, zsbuf);
00357 
00358    trace_dump_struct_end();
00359 }
00360 
00361 
00362 void trace_dump_sampler_state(const struct pipe_sampler_state *state)
00363 {
00364    if(!state) {
00365       trace_dump_null();
00366       return;
00367    }
00368 
00369    trace_dump_struct_begin("pipe_sampler_state");
00370 
00371    trace_dump_member(uint, state, wrap_s);
00372    trace_dump_member(uint, state, wrap_t);
00373    trace_dump_member(uint, state, wrap_r);
00374    trace_dump_member(uint, state, min_img_filter);
00375    trace_dump_member(uint, state, min_mip_filter);
00376    trace_dump_member(uint, state, mag_img_filter);
00377    trace_dump_member(bool, state, compare_mode);
00378    trace_dump_member(uint, state, compare_func);
00379    trace_dump_member(bool, state, normalized_coords);
00380    trace_dump_member(uint, state, prefilter);
00381    trace_dump_member(float, state, shadow_ambient);
00382    trace_dump_member(float, state, lod_bias);
00383    trace_dump_member(float, state, min_lod);
00384    trace_dump_member(float, state, max_lod);
00385    trace_dump_member_array(float, state, border_color);
00386    trace_dump_member(float, state, max_anisotropy);
00387 
00388    trace_dump_struct_end();
00389 }
00390 
00391 
00392 void trace_dump_surface(const struct pipe_surface *state)
00393 {
00394    if(!state) {
00395       trace_dump_null();
00396       return;
00397    }
00398 
00399    trace_dump_struct_begin("pipe_surface");
00400 
00401    trace_dump_member(ptr, state, buffer);
00402    trace_dump_member(format, state, format);
00403    trace_dump_member(uint, state, status);
00404    trace_dump_member(uint, state, clear_value);
00405    trace_dump_member(uint, state, width);
00406    trace_dump_member(uint, state, height);
00407 
00408    trace_dump_member_begin("block");
00409    trace_dump_block(&state->block);
00410    trace_dump_member_end();
00411    
00412    trace_dump_member(uint, state, nblocksx);
00413    trace_dump_member(uint, state, nblocksy);
00414    trace_dump_member(uint, state, stride);
00415    trace_dump_member(uint, state, layout);
00416    trace_dump_member(uint, state, offset);
00417    trace_dump_member(uint, state, refcount);
00418    trace_dump_member(uint, state, usage);
00419 
00420    trace_dump_member(ptr, state, texture);
00421    trace_dump_member(uint, state, face);
00422    trace_dump_member(uint, state, level);
00423    trace_dump_member(uint, state, zslice);
00424 
00425    trace_dump_struct_end();
00426 }
00427 
00428 
00429 void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state)
00430 {
00431    if(!state) {
00432       trace_dump_null();
00433       return;
00434    }
00435 
00436    trace_dump_struct_begin("pipe_vertex_buffer");
00437 
00438    trace_dump_member(uint, state, pitch);
00439    trace_dump_member(uint, state, max_index);
00440    trace_dump_member(uint, state, buffer_offset);
00441    trace_dump_member(ptr, state, buffer);
00442 
00443    trace_dump_struct_end();
00444 }
00445 
00446 
00447 void trace_dump_vertex_element(const struct pipe_vertex_element *state)
00448 {
00449    if(!state) {
00450       trace_dump_null();
00451       return;
00452    }
00453 
00454    trace_dump_struct_begin("pipe_vertex_element");
00455 
00456    trace_dump_member(uint, state, src_offset);
00457 
00458    trace_dump_member(uint, state, vertex_buffer_index);
00459    trace_dump_member(uint, state, nr_components);
00460  
00461    trace_dump_member(format, state, src_format);
00462 
00463    trace_dump_struct_end();
00464 }

Generated on Tue Sep 29 06:25:17 2009 for Gallium3D by  doxygen 1.5.4