summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-08-07 18:55:05 +0100
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-08-07 18:58:30 +0100
commit9dee60969df7ff263e05430e69ef26982fe2bd94 (patch)
tree5f5723afe4c237c8c721ebea57d8dabb312ea9e3 /src/gallium/drivers
parentf2e19c34e06dfc33557a481f764fc75a5aef15ff (diff)
trace: Dump state.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/trace/tr_context.c37
-rw-r--r--src/gallium/drivers/trace/tr_dump.c10
-rw-r--r--src/gallium/drivers/trace/tr_dump.h31
-rw-r--r--src/gallium/drivers/trace/tr_state.c433
-rw-r--r--src/gallium/drivers/trace/tr_state.h57
-rw-r--r--src/gallium/drivers/trace/trace.xsl6
6 files changed, 549 insertions, 25 deletions
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index 6161e35fa5..ee8ad5eb97 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -280,7 +280,7 @@ trace_context_create_blend_state(struct pipe_context *_pipe,
trace_dump_call_begin(stream, "pipe_context", "create_blend_state");
trace_dump_arg(stream, ptr, pipe);
- trace_dump_arg(stream, ptr, state);
+ trace_dump_arg(stream, blend_state, state);
result = pipe->create_blend_state(pipe, state);;
@@ -347,7 +347,7 @@ trace_context_create_sampler_state(struct pipe_context *_pipe,
result = pipe->create_sampler_state(pipe, state);;
- trace_dump_ret(stream, ptr, result);
+ trace_dump_ret(stream, sampler_state, result);
trace_dump_call_end(stream);
@@ -409,7 +409,7 @@ trace_context_create_rasterizer_state(struct pipe_context *_pipe,
trace_dump_call_begin(stream, "pipe_context", "create_rasterizer_state");
trace_dump_arg(stream, ptr, pipe);
- trace_dump_arg(stream, ptr, state);
+ trace_dump_arg(stream, rasterizer_state, state);
result = pipe->create_rasterizer_state(pipe, state);;
@@ -476,7 +476,7 @@ trace_context_create_depth_stencil_alpha_state(struct pipe_context *_pipe,
result = pipe->create_depth_stencil_alpha_state(pipe, state);;
trace_dump_ret(stream, ptr, result);
- trace_dump_arg(stream, ptr, state);
+ trace_dump_arg(stream, depth_stencil_alpha_state, state);
trace_dump_call_end(stream);
@@ -537,7 +537,7 @@ trace_context_create_fs_state(struct pipe_context *_pipe,
trace_dump_call_begin(stream, "pipe_context", "create_fs_state");
trace_dump_arg(stream, ptr, pipe);
- trace_dump_arg(stream, ptr, state);
+ trace_dump_arg(stream, shader_state, state);
result = pipe->create_fs_state(pipe, state);;
@@ -602,7 +602,7 @@ trace_context_create_vs_state(struct pipe_context *_pipe,
trace_dump_call_begin(stream, "pipe_context", "create_vs_state");
trace_dump_arg(stream, ptr, pipe);
- trace_dump_arg(stream, ptr, state);
+ trace_dump_arg(stream, shader_state, state);
result = pipe->create_vs_state(pipe, state);;
@@ -666,7 +666,7 @@ trace_context_set_blend_color(struct pipe_context *_pipe,
trace_dump_call_begin(stream, "pipe_context", "set_blend_color");
trace_dump_arg(stream, ptr, pipe);
- trace_dump_arg(stream, ptr, state);
+ trace_dump_arg(stream, blend_color, state);
pipe->set_blend_color(pipe, state);;
@@ -686,7 +686,7 @@ trace_context_set_clip_state(struct pipe_context *_pipe,
trace_dump_call_begin(stream, "pipe_context", "set_clip_state");
trace_dump_arg(stream, ptr, pipe);
- trace_dump_arg(stream, ptr, state);
+ trace_dump_arg(stream, clip_state, state);
pipe->set_clip_state(pipe, state);;
@@ -709,7 +709,7 @@ trace_context_set_constant_buffer(struct pipe_context *_pipe,
trace_dump_arg(stream, ptr, pipe);
trace_dump_arg(stream, uint, shader);
trace_dump_arg(stream, uint, index);
- trace_dump_arg(stream, ptr, buffer);
+ trace_dump_arg(stream, constant_buffer, buffer);
pipe->set_constant_buffer(pipe, shader, index, buffer);;
@@ -729,7 +729,7 @@ trace_context_set_framebuffer_state(struct pipe_context *_pipe,
trace_dump_call_begin(stream, "pipe_context", "set_framebuffer_state");
trace_dump_arg(stream, ptr, pipe);
- trace_dump_arg(stream, ptr, state);
+ trace_dump_arg(stream, framebuffer_state, state);
pipe->set_framebuffer_state(pipe, state);;
@@ -749,7 +749,7 @@ trace_context_set_polygon_stipple(struct pipe_context *_pipe,
trace_dump_call_begin(stream, "pipe_context", "set_polygon_stipple");
trace_dump_arg(stream, ptr, pipe);
- trace_dump_arg(stream, ptr, state);
+ trace_dump_arg(stream, poly_stipple, state);
pipe->set_polygon_stipple(pipe, state);;
@@ -769,7 +769,7 @@ trace_context_set_scissor_state(struct pipe_context *_pipe,
trace_dump_call_begin(stream, "pipe_context", "set_scissor_state");
trace_dump_arg(stream, ptr, pipe);
- trace_dump_arg(stream, ptr, state);
+ trace_dump_arg(stream, scissor_state, state);
pipe->set_scissor_state(pipe, state);;
@@ -789,7 +789,7 @@ trace_context_set_viewport_state(struct pipe_context *_pipe,
trace_dump_call_begin(stream, "pipe_context", "set_viewport_state");
trace_dump_arg(stream, ptr, pipe);
- trace_dump_arg(stream, ptr, state);
+ trace_dump_arg(stream, viewport_state, state);
pipe->set_viewport_state(pipe, state);;
@@ -833,8 +833,10 @@ trace_context_set_vertex_buffers(struct pipe_context *_pipe,
trace_dump_arg(stream, ptr, pipe);
trace_dump_arg(stream, uint, num_buffers);
- trace_dump_arg(stream, ptr, buffers);
- //trace_dump_arg_array(stream, ptr, buffers, num_buffers);
+
+ trace_dump_arg_begin(stream, "buffers");
+ trace_dump_struct_array(stream, vertex_buffer, buffers, num_buffers);
+ trace_dump_arg_end(stream);
pipe->set_vertex_buffers(pipe, num_buffers, buffers);;
@@ -857,7 +859,10 @@ trace_context_set_vertex_elements(struct pipe_context *_pipe,
trace_dump_arg(stream, ptr, pipe);
trace_dump_arg(stream, uint, num_elements);
trace_dump_arg(stream, ptr, elements);
- //trace_dump_arg_array(stream, ptr, elements, num_elements);
+
+ trace_dump_arg_begin(stream, "elements");
+ trace_dump_struct_array(stream, vertex_element, elements, num_elements);
+ trace_dump_arg_end(stream);
pipe->set_vertex_elements(pipe, num_elements, elements);;
diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c
index 30c0986363..0591b9fc33 100644
--- a/src/gallium/drivers/trace/tr_dump.c
+++ b/src/gallium/drivers/trace/tr_dump.c
@@ -322,8 +322,16 @@ void trace_dump_member_end(struct trace_stream *stream)
trace_dump_write(stream, "</member>");
}
+void trace_dump_null(struct trace_stream *stream)
+{
+ trace_dump_write(stream, "<null/>");
+}
+
void trace_dump_ptr(struct trace_stream *stream,
const void *value)
{
- trace_dump_writef(stream, "<ptr>%p</ptr>", value);
+ if(value)
+ trace_dump_writef(stream, "<ptr>%p</ptr>", value);
+ else
+ trace_dump_null(stream);
}
diff --git a/src/gallium/drivers/trace/tr_dump.h b/src/gallium/drivers/trace/tr_dump.h
index 0be0812ce8..5eeac8d3c5 100644
--- a/src/gallium/drivers/trace/tr_dump.h
+++ b/src/gallium/drivers/trace/tr_dump.h
@@ -34,6 +34,9 @@
#define TR_DUMP_H
+#include "pipe/p_util.h"
+
+
struct trace_stream;
@@ -58,6 +61,7 @@ void trace_dump_struct_begin(struct trace_stream *stream, const char *name);
void trace_dump_struct_end(struct trace_stream *stream);
void trace_dump_member_begin(struct trace_stream *stream, const char *name);
void trace_dump_member_end(struct trace_stream *stream);
+void trace_dump_null(struct trace_stream *stream);
void trace_dump_ptr(struct trace_stream *stream, const void *value);
@@ -83,14 +87,33 @@ void trace_dump_ptr(struct trace_stream *stream, const void *value);
do { \
unsigned long idx; \
trace_dump_array_begin(_stream); \
- for(idx = 0; idx < _size; ++idx) { \
+ for(idx = 0; idx < (_size); ++idx) { \
+ trace_dump_elem_begin(_stream); \
+ trace_dump_##_type(_stream, (_obj)[idx]); \
+ trace_dump_elem_end(_stream); \
+ } \
+ trace_dump_array_end(_stream); \
+ } while(0)
+
+#define trace_dump_struct_array(_stream, _type, _obj, _size) \
+ do { \
+ unsigned long idx; \
+ trace_dump_array_begin(_stream); \
+ for(idx = 0; idx < (_size); ++idx) { \
trace_dump_elem_begin(_stream); \
- trace_dump_##_type(_stream, _obj[idx]); \
+ trace_dump_##_type(_stream, &(_obj)[idx]); \
trace_dump_elem_end(_stream); \
} \
trace_dump_array_end(_stream); \
} while(0)
+#define trace_dump_member(_stream, _type, _obj, _member) \
+ do { \
+ trace_dump_member_begin(_stream, #_member); \
+ trace_dump_##_type(_stream, (_obj)->_member); \
+ trace_dump_member_end(_stream); \
+ } while(0)
+
#define trace_dump_arg_array(_stream, _type, _arg, _size) \
do { \
trace_dump_arg_begin(_stream, #_arg); \
@@ -98,10 +121,10 @@ void trace_dump_ptr(struct trace_stream *stream, const void *value);
trace_dump_arg_end(_stream); \
} while(0)
-#define trace_dump_member(_stream, _type, _obj, _member) \
+#define trace_dump_member_array(_stream, _type, _obj, _member) \
do { \
trace_dump_member_begin(_stream, #_member); \
- trace_dump_##_type(_stream, _obj->_member); \
+ trace_dump_array(_stream, _type, (_obj)->_member, sizeof((_obj)->_member)/sizeof((_obj)->_member[0])); \
trace_dump_member_end(_stream); \
} while(0)
diff --git a/src/gallium/drivers/trace/tr_state.c b/src/gallium/drivers/trace/tr_state.c
index 1e0e87f7fd..f18f5c611e 100644
--- a/src/gallium/drivers/trace/tr_state.c
+++ b/src/gallium/drivers/trace/tr_state.c
@@ -27,12 +27,19 @@
#include "pipe/p_compiler.h"
-#include "pipe/p_state.h"
+#include "tgsi/tgsi_parse.h"
#include "tr_dump.h"
#include "tr_state.h"
+void trace_dump_format(struct trace_stream *stream,
+ enum pipe_format format)
+{
+ trace_dump_int(stream, format);
+}
+
+
void trace_dump_block(struct trace_stream *stream,
const struct pipe_format_block *block)
{
@@ -44,9 +51,32 @@ void trace_dump_block(struct trace_stream *stream,
}
+void trace_dump_buffer(struct trace_stream *stream,
+ const struct pipe_buffer *buffer)
+{
+ if(!buffer) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ trace_dump_struct_begin(stream, "pipe_buffer");
+ trace_dump_member(stream, uint, buffer, alignment);
+ trace_dump_member(stream, uint, buffer, usage);
+ trace_dump_member(stream, uint, buffer, size);
+ /* TODO: buffer data */
+ trace_dump_struct_end(stream);
+}
+
+
void trace_dump_template(struct trace_stream *stream,
const struct pipe_texture *templat)
{
+ assert(templat);
+ if(!templat) {
+ trace_dump_null(stream);
+ return;
+ }
+
trace_dump_struct_begin(stream, "pipe_texture");
trace_dump_member(stream, int, templat, target);
@@ -70,3 +100,404 @@ void trace_dump_template(struct trace_stream *stream,
trace_dump_struct_end(stream);
}
+
+void trace_dump_rasterizer_state(struct trace_stream *stream,
+ const struct pipe_rasterizer_state *state)
+{
+ assert(state);
+ if(!state) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ trace_dump_struct_begin(stream, "pipe_rasterizer_state");
+
+ trace_dump_member(stream, bool, state, flatshade);
+ trace_dump_member(stream, bool, state, light_twoside);
+ trace_dump_member(stream, uint, state, front_winding);
+ trace_dump_member(stream, uint, state, cull_mode);
+ trace_dump_member(stream, uint, state, fill_cw);
+ trace_dump_member(stream, uint, state, fill_ccw);
+ trace_dump_member(stream, bool, state, offset_cw);
+ trace_dump_member(stream, bool, state, offset_ccw);
+ trace_dump_member(stream, bool, state, scissor);
+ trace_dump_member(stream, bool, state, poly_smooth);
+ trace_dump_member(stream, bool, state, poly_stipple_enable);
+ trace_dump_member(stream, bool, state, point_smooth);
+ trace_dump_member(stream, bool, state, point_sprite);
+ trace_dump_member(stream, bool, state, point_size_per_vertex);
+ trace_dump_member(stream, bool, state, multisample);
+ trace_dump_member(stream, bool, state, line_smooth);
+ trace_dump_member(stream, bool, state, line_stipple_enable);
+ trace_dump_member(stream, uint, state, line_stipple_factor);
+ trace_dump_member(stream, uint, state, line_stipple_pattern);
+ trace_dump_member(stream, bool, state, line_last_pixel);
+ trace_dump_member(stream, bool, state, bypass_clipping);
+ trace_dump_member(stream, bool, state, bypass_vs);
+ trace_dump_member(stream, bool, state, origin_lower_left);
+ trace_dump_member(stream, bool, state, flatshade_first);
+ trace_dump_member(stream, bool, state, gl_rasterization_rules);
+
+ trace_dump_member(stream, float, state, line_width);
+ trace_dump_member(stream, float, state, point_size);
+ trace_dump_member(stream, float, state, point_size_min);
+ trace_dump_member(stream, float, state, point_size_max);
+ trace_dump_member(stream, float, state, offset_units);
+ trace_dump_member(stream, float, state, offset_scale);
+
+ trace_dump_member_array(stream, uint, state, sprite_coord_mode);
+
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_poly_stipple(struct trace_stream *stream,
+ const struct pipe_poly_stipple *state)
+{
+ assert(state);
+ if(!state) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ trace_dump_struct_begin(stream, "pipe_poly_stipple");
+
+ trace_dump_member_array(stream, uint, state, stipple);
+
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_viewport_state(struct trace_stream *stream,
+ const struct pipe_viewport_state *state)
+{
+ assert(state);
+ if(!state) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ trace_dump_struct_begin(stream, "pipe_viewport_state");
+
+ trace_dump_member_array(stream, float, state, scale);
+ trace_dump_member_array(stream, float, state, translate);
+
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_scissor_state(struct trace_stream *stream,
+ const struct pipe_scissor_state *state)
+{
+ assert(state);
+ if(!state) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ trace_dump_struct_begin(stream, "pipe_scissor_state");
+
+ trace_dump_member(stream, uint, state, minx);
+ trace_dump_member(stream, uint, state, miny);
+ trace_dump_member(stream, uint, state, maxx);
+ trace_dump_member(stream, uint, state, maxy);
+
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_clip_state(struct trace_stream *stream,
+ const struct pipe_clip_state *state)
+{
+ unsigned i;
+
+ assert(state);
+ if(!state) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ trace_dump_struct_begin(stream, "pipe_scissor_state");
+
+ trace_dump_member_begin(stream, "ucp");
+ trace_dump_array_begin(stream);
+ for(i = 0; i < PIPE_MAX_CLIP_PLANES; ++i)
+ trace_dump_array(stream, float, state->ucp[i], 4);
+ trace_dump_array_end(stream);
+ trace_dump_member_end(stream);
+
+ trace_dump_member(stream, uint, state, nr);
+
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_constant_buffer(struct trace_stream *stream,
+ const struct pipe_constant_buffer *state)
+{
+ assert(state);
+ if(!state) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ trace_dump_struct_begin(stream, "pipe_constant_buffer");
+
+ trace_dump_member(stream, buffer, state, buffer);
+ trace_dump_member(stream, uint, state, size);
+
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_shader_state(struct trace_stream *stream,
+ const struct pipe_shader_state *state)
+{
+ uint32_t *p = (uint32_t *)state->tokens;
+ unsigned n = tgsi_num_tokens(state->tokens);
+
+ assert(state);
+ if(!state) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ assert(sizeof(struct tgsi_token) == 4);
+
+ trace_dump_struct_begin(stream, "pipe_shader_state");
+
+ trace_dump_member_begin(stream, "tokens");
+ trace_dump_array(stream, uint, p, n);
+ trace_dump_member_end(stream);
+
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_depth_stencil_alpha_state(struct trace_stream *stream,
+ const struct pipe_depth_stencil_alpha_state *state)
+{
+ unsigned i;
+
+ assert(state);
+ if(!state) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ trace_dump_struct_begin(stream, "pipe_depth_stencil_alpha_state");
+
+ trace_dump_member_begin(stream, "depth");
+ trace_dump_struct_begin(stream, "");
+ trace_dump_member(stream, bool, &state->depth, enabled);
+ trace_dump_member(stream, bool, &state->depth, writemask);
+ trace_dump_member(stream, uint, &state->depth, func);
+ trace_dump_member(stream, bool, &state->depth, occlusion_count);
+ trace_dump_struct_end(stream);
+ trace_dump_member_end(stream);
+
+ trace_dump_member_begin(stream, "stencil");
+ trace_dump_array_begin(stream);
+ for(i = 0; i < Elements(state->stencil); ++i) {
+ trace_dump_elem_begin(stream);
+ trace_dump_struct_begin(stream, "");
+ trace_dump_member(stream, bool, &state->stencil[i], enabled);
+ trace_dump_member(stream, uint, &state->stencil[i], func);
+ trace_dump_member(stream, uint, &state->stencil[i], fail_op);
+ trace_dump_member(stream, uint, &state->stencil[i], zpass_op);
+ trace_dump_member(stream, uint, &state->stencil[i], zfail_op);
+ trace_dump_member(stream, uint, &state->stencil[i], ref_value);
+ trace_dump_member(stream, uint, &state->stencil[i], value_mask);
+ trace_dump_member(stream, uint, &state->stencil[i], write_mask);
+ trace_dump_struct_end(stream);
+ trace_dump_elem_end(stream);
+ }
+ trace_dump_array_end(stream);
+ trace_dump_member_end(stream);
+
+ trace_dump_member_begin(stream, "alpha");
+ trace_dump_struct_begin(stream, "");
+ trace_dump_member(stream, bool, &state->alpha, enabled);
+ trace_dump_member(stream, uint, &state->alpha, func);
+ trace_dump_member(stream, float, &state->alpha, ref);
+ trace_dump_struct_end(stream);
+ trace_dump_member_end(stream);
+
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_blend_state(struct trace_stream *stream,
+ const struct pipe_blend_state *state)
+{
+ assert(state);
+ if(!state) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ trace_dump_struct_begin(stream, "pipe_blend_state");
+
+ trace_dump_member(stream, bool, state, blend_enable);
+
+ trace_dump_member(stream, uint, state, rgb_func);
+ trace_dump_member(stream, uint, state, rgb_src_factor);
+ trace_dump_member(stream, uint, state, rgb_dst_factor);
+
+ trace_dump_member(stream, uint, state, alpha_func);
+ trace_dump_member(stream, uint, state, alpha_src_factor);
+ trace_dump_member(stream, uint, state, alpha_dst_factor);
+
+ trace_dump_member(stream, bool, state, logicop_enable);
+ trace_dump_member(stream, uint, state, logicop_func);
+
+ trace_dump_member(stream, uint, state, colormask);
+ trace_dump_member(stream, bool, state, dither);
+
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_blend_color(struct trace_stream *stream,
+ const struct pipe_blend_color *state)
+{
+ assert(state);
+ if(!state) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ trace_dump_struct_begin(stream, "pipe_blend_color");
+
+ trace_dump_member_array(stream, float, state, color);
+
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_framebuffer_state(struct trace_stream *stream,
+ const struct pipe_framebuffer_state *state)
+{
+ trace_dump_struct_begin(stream, "pipe_framebuffer_state");
+
+ trace_dump_member(stream, uint, state, width);
+ trace_dump_member(stream, uint, state, height);
+ trace_dump_member(stream, uint, state, num_cbufs);
+ trace_dump_member_array(stream, ptr, state, cbufs);
+ trace_dump_member(stream, ptr, state, zsbuf);
+
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_sampler_state(struct trace_stream *stream,
+ const struct pipe_sampler_state *state)
+{
+ assert(state);
+ if(!state) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ trace_dump_struct_begin(stream, "pipe_sampler_state");
+
+ trace_dump_member(stream, uint, state, wrap_s);
+ trace_dump_member(stream, uint, state, wrap_t);
+ trace_dump_member(stream, uint, state, wrap_r);
+ trace_dump_member(stream, uint, state, min_img_filter);
+ trace_dump_member(stream, uint, state, min_mip_filter);
+ trace_dump_member(stream, uint, state, mag_img_filter);
+ trace_dump_member(stream, bool, state, compare_mode);
+ trace_dump_member(stream, uint, state, compare_func);
+ trace_dump_member(stream, bool, state, normalized_coords);
+ trace_dump_member(stream, uint, state, prefilter);
+ trace_dump_member(stream, float, state, shadow_ambient);
+ trace_dump_member(stream, float, state, lod_bias);
+ trace_dump_member(stream, float, state, min_lod);
+ trace_dump_member(stream, float, state, max_lod);
+ trace_dump_member_array(stream, float, state, border_color);
+ trace_dump_member(stream, float, state, max_anisotropy);
+
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_surface(struct trace_stream *stream,
+ const struct pipe_surface *state)
+{
+ assert(state);
+ if(!state) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ trace_dump_struct_begin(stream, "pipe_surface");
+
+ trace_dump_member(stream, buffer, state, buffer);
+ trace_dump_member(stream, format, state, format);
+ trace_dump_member(stream, uint, state, status);
+ trace_dump_member(stream, uint, state, clear_value);
+ trace_dump_member(stream, uint, state, width);
+ trace_dump_member(stream, uint, state, height);
+
+ trace_dump_member_begin(stream, "block");
+ trace_dump_block(stream, &state->block);
+ trace_dump_member_end(stream);
+
+ trace_dump_member(stream, uint, state, nblocksx);
+ trace_dump_member(stream, uint, state, nblocksy);
+ trace_dump_member(stream, uint, state, stride);
+ trace_dump_member(stream, uint, state, layout);
+ trace_dump_member(stream, uint, state, offset);
+ trace_dump_member(stream, uint, state, refcount);
+ trace_dump_member(stream, uint, state, usage);
+
+ trace_dump_member(stream, ptr, state, texture);
+ trace_dump_member(stream, uint, state, face);
+ trace_dump_member(stream, uint, state, level);
+ trace_dump_member(stream, uint, state, zslice);
+
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_vertex_buffer(struct trace_stream *stream,
+ const struct pipe_vertex_buffer *state)
+{
+ assert(state);
+ if(!state) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ trace_dump_struct_begin(stream, "pipe_vertex_buffer");
+
+ trace_dump_member(stream, uint, state, pitch);
+ trace_dump_member(stream, uint, state, max_index);
+ trace_dump_member(stream, uint, state, buffer_offset);
+ trace_dump_member(stream, buffer, state, buffer);
+
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_vertex_element(struct trace_stream *stream,
+ const struct pipe_vertex_element *state)
+{
+ assert(state);
+ if(!state) {
+ trace_dump_null(stream);
+ return;
+ }
+
+ trace_dump_struct_begin(stream, "pipe_vertex_element");
+
+ trace_dump_member(stream, uint, state, src_offset);
+
+ trace_dump_member(stream, uint, state, vertex_buffer_index);
+ trace_dump_member(stream, uint, state, nr_components);
+
+ trace_dump_member(stream, format, state, src_format);
+
+ trace_dump_struct_end(stream);
+}
diff --git a/src/gallium/drivers/trace/tr_state.h b/src/gallium/drivers/trace/tr_state.h
index e52524ee90..c1df63db6a 100644
--- a/src/gallium/drivers/trace/tr_state.h
+++ b/src/gallium/drivers/trace/tr_state.h
@@ -28,11 +28,13 @@
#ifndef TR_STATE_H
#define TR_STATE_H
+#include "pipe/p_format.h"
+#include "pipe/p_state.h"
+#include "pipe/p_shader_tokens.h"
-struct trace_stream;
-struct pipe_format_block;
-struct pipe_texture;
+void trace_dump_format(struct trace_stream *stream,
+ enum pipe_format format);
void trace_dump_block(struct trace_stream *stream,
const struct pipe_format_block *block);
@@ -41,4 +43,53 @@ void trace_dump_template(struct trace_stream *stream,
const struct pipe_texture *templat);
+void trace_dump_rasterizer_state(struct trace_stream *stream,
+ const struct pipe_rasterizer_state *state);
+
+void trace_dump_poly_stipple(struct trace_stream *stream,
+ const struct pipe_poly_stipple *state);
+
+void trace_dump_viewport_state(struct trace_stream *stream,
+ const struct pipe_viewport_state *state);
+
+void trace_dump_scissor_state(struct trace_stream *stream,
+ const struct pipe_scissor_state *state);
+
+void trace_dump_clip_state(struct trace_stream *stream,
+ const struct pipe_clip_state *state);
+
+void trace_dump_constant_buffer(struct trace_stream *stream,
+ const struct pipe_constant_buffer *state);
+
+void trace_dump_token(struct trace_stream *stream,
+ const struct tgsi_token *token);
+
+void trace_dump_shader_state(struct trace_stream *stream,
+ const struct pipe_shader_state *state);
+
+void trace_dump_depth_stencil_alpha_state(struct trace_stream *stream,
+ const struct pipe_depth_stencil_alpha_state *state);
+
+void trace_dump_blend_state(struct trace_stream *stream,
+ const struct pipe_blend_state *state);
+
+void trace_dump_blend_color(struct trace_stream *stream,
+ const struct pipe_blend_color *state);
+
+void trace_dump_framebuffer_state(struct trace_stream *stream,
+ const struct pipe_framebuffer_state *state);
+
+void trace_dump_sampler_state(struct trace_stream *stream,
+ const struct pipe_sampler_state *state);
+
+void trace_dump_surface(struct trace_stream *stream,
+ const struct pipe_surface *state);
+
+void trace_dump_vertex_buffer(struct trace_stream *stream,
+ const struct pipe_vertex_buffer *state);
+
+void trace_dump_vertex_element(struct trace_stream *stream,
+ const struct pipe_vertex_element *state);
+
+
#endif /* TR_STATE_H */
diff --git a/src/gallium/drivers/trace/trace.xsl b/src/gallium/drivers/trace/trace.xsl
index ace4020cf9..194c8b2efd 100644
--- a/src/gallium/drivers/trace/trace.xsl
+++ b/src/gallium/drivers/trace/trace.xsl
@@ -100,6 +100,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</li>
</xsl:template>
+ <xsl:template match="null">
+ <span class="ptr">
+ <xsl:text>NULL</xsl:text>
+ </span>
+ </xsl:template>
+
<xsl:template match="ptr">
<span class="ptr">
<xsl:value-of select="text()"/>