From 4185da4681405f3cc4d0cc601d428f2f44d0dda8 Mon Sep 17 00:00:00 2001 From: keithw Date: Sat, 25 Aug 2007 22:00:36 +0100 Subject: [PATCH] add names to tracked state atoms to improve debug --- src/mesa/state_tracker/st_atom.c | 9 ++++++++- src/mesa/state_tracker/st_atom_alphatest.c | 1 + src/mesa/state_tracker/st_atom_blend.c | 1 + src/mesa/state_tracker/st_atom_clear_color.c | 1 + src/mesa/state_tracker/st_atom_clip.c | 1 + src/mesa/state_tracker/st_atom_depth.c | 1 + src/mesa/state_tracker/st_atom_framebuffer.c | 1 + src/mesa/state_tracker/st_atom_fs.c | 1 + src/mesa/state_tracker/st_atom_sampler.c | 1 + src/mesa/state_tracker/st_atom_scissor.c | 1 + src/mesa/state_tracker/st_atom_setup.c | 1 + src/mesa/state_tracker/st_atom_stencil.c | 1 + src/mesa/state_tracker/st_atom_stipple.c | 1 + src/mesa/state_tracker/st_atom_texture.c | 1 + src/mesa/state_tracker/st_atom_viewport.c | 1 + src/mesa/state_tracker/st_atom_vs.c | 1 + src/mesa/state_tracker/st_context.h | 1 + 17 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index 99fcbdfda7b..66ab5d7c3a7 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -155,6 +155,8 @@ void st_validate_state( struct st_context *st ) if (state->st == 0) return; +// _mesa_printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st); + if (1) { /* Debug version which enforces various sanity checks on the * state flags which are generated and checked to help ensure @@ -168,14 +170,17 @@ void st_validate_state( struct st_context *st ) const struct st_tracked_state *atom = st->atoms[i]; struct st_state_flags generated; +// _mesa_printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st); + if (!(atom->dirty.mesa || atom->dirty.st) || !atom->update) { - _mesa_printf("malformed atom %d\n", i); + _mesa_printf("malformed atom %s\n", atom->name); assert(0); } if (check_state(state, &atom->dirty)) { st->atoms[i]->update( st ); +// _mesa_printf("after: %x\n", atom->dirty.mesa); } accumulate_state(&examined, &atom->dirty); @@ -188,6 +193,8 @@ void st_validate_state( struct st_context *st ) assert(!check_state(&examined, &generated)); prev = *state; } +// _mesa_printf("\n"); + } else { const GLuint nr = st->nr_atoms; diff --git a/src/mesa/state_tracker/st_atom_alphatest.c b/src/mesa/state_tracker/st_atom_alphatest.c index 1e2e4497951..4378154053d 100644 --- a/src/mesa/state_tracker/st_atom_alphatest.c +++ b/src/mesa/state_tracker/st_atom_alphatest.c @@ -81,6 +81,7 @@ update_alpha_test( struct st_context *st ) const struct st_tracked_state st_update_alpha_test = { + .name = "st_update_alpha_test", .dirty = { .mesa = (_NEW_COLOR), .st = 0, diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c index 256f13471a2..afd21a6141c 100644 --- a/src/mesa/state_tracker/st_atom_blend.c +++ b/src/mesa/state_tracker/st_atom_blend.c @@ -227,6 +227,7 @@ update_blend( struct st_context *st ) const struct st_tracked_state st_update_blend = { + .name = "st_update_blend", .dirty = { .mesa = (_NEW_COLOR), /* XXX _NEW_BLEND someday? */ .st = 0, diff --git a/src/mesa/state_tracker/st_atom_clear_color.c b/src/mesa/state_tracker/st_atom_clear_color.c index adf730cd8cc..ce3431c5d37 100644 --- a/src/mesa/state_tracker/st_atom_clear_color.c +++ b/src/mesa/state_tracker/st_atom_clear_color.c @@ -54,6 +54,7 @@ update_clear_color_state( struct st_context *st ) const struct st_tracked_state st_update_clear_color = { + .name = "st_update_clear_color", .dirty = { .mesa = _NEW_COLOR, .st = 0, diff --git a/src/mesa/state_tracker/st_atom_clip.c b/src/mesa/state_tracker/st_atom_clip.c index 8ccad637d5f..a6f05686608 100644 --- a/src/mesa/state_tracker/st_atom_clip.c +++ b/src/mesa/state_tracker/st_atom_clip.c @@ -62,6 +62,7 @@ static void update_clip( struct st_context *st ) const struct st_tracked_state st_update_clip = { + .name = "st_update_clip", .dirty = { .mesa = (_NEW_TRANSFORM), .st = 0, diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c index 7fc51953dc6..df05c79e365 100644 --- a/src/mesa/state_tracker/st_atom_depth.c +++ b/src/mesa/state_tracker/st_atom_depth.c @@ -84,6 +84,7 @@ update_depth( struct st_context *st ) const struct st_tracked_state st_update_depth = { + .name = "st_update_depth", .dirty = { .mesa = (_NEW_DEPTH), .st = 0, diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index f054eb8f211..3c4b37e7c5a 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -82,6 +82,7 @@ update_framebuffer_state( struct st_context *st ) const struct st_tracked_state st_update_framebuffer = { + .name = "st_update_framebuffer", .dirty = { .mesa = _NEW_BUFFERS, .st = 0, diff --git a/src/mesa/state_tracker/st_atom_fs.c b/src/mesa/state_tracker/st_atom_fs.c index f706761198c..767816bf231 100644 --- a/src/mesa/state_tracker/st_atom_fs.c +++ b/src/mesa/state_tracker/st_atom_fs.c @@ -99,6 +99,7 @@ static void update_fs( struct st_context *st ) const struct st_tracked_state st_update_fs = { + .name = "st_update_fs", .dirty = { .mesa = 0, .st = ST_NEW_FRAGMENT_PROGRAM, diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 7d568baf9e6..d65565f991d 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -152,6 +152,7 @@ update_samplers(struct st_context *st) const struct st_tracked_state st_update_sampler = { + .name = "st_update_sampler", .dirty = { .mesa = _NEW_TEXTURE, .st = 0, diff --git a/src/mesa/state_tracker/st_atom_scissor.c b/src/mesa/state_tracker/st_atom_scissor.c index 2bf633828e1..59601e91a11 100644 --- a/src/mesa/state_tracker/st_atom_scissor.c +++ b/src/mesa/state_tracker/st_atom_scissor.c @@ -83,6 +83,7 @@ update_scissor( struct st_context *st ) const struct st_tracked_state st_update_scissor = { + .name = "st_update_scissor", .dirty = { .mesa = (_NEW_SCISSOR | _NEW_BUFFERS), .st = 0, diff --git a/src/mesa/state_tracker/st_atom_setup.c b/src/mesa/state_tracker/st_atom_setup.c index 3eac2588df2..09d921560d2 100644 --- a/src/mesa/state_tracker/st_atom_setup.c +++ b/src/mesa/state_tracker/st_atom_setup.c @@ -211,6 +211,7 @@ static void update_setup_state( struct st_context *st ) } const struct st_tracked_state st_update_setup = { + .name = "st_update_setup", .dirty = { .mesa = (_NEW_LIGHT | _NEW_POLYGON | _NEW_LINE | _NEW_SCISSOR | _NEW_POINT | _NEW_BUFFERS | _NEW_MULTISAMPLE), diff --git a/src/mesa/state_tracker/st_atom_stencil.c b/src/mesa/state_tracker/st_atom_stencil.c index d037335e9e2..b8aec0b3b65 100644 --- a/src/mesa/state_tracker/st_atom_stencil.c +++ b/src/mesa/state_tracker/st_atom_stencil.c @@ -127,6 +127,7 @@ update_stencil( struct st_context *st ) const struct st_tracked_state st_update_stencil = { + .name = "st_update_stencil", .dirty = { .mesa = (_NEW_STENCIL), .st = 0, diff --git a/src/mesa/state_tracker/st_atom_stipple.c b/src/mesa/state_tracker/st_atom_stipple.c index dd04d2158c7..c91214059a7 100644 --- a/src/mesa/state_tracker/st_atom_stipple.c +++ b/src/mesa/state_tracker/st_atom_stipple.c @@ -54,6 +54,7 @@ update_stipple( struct st_context *st ) const struct st_tracked_state st_update_polygon_stipple = { + .name = "st_update_polygon_stipple", .dirty = { .mesa = (_NEW_POLYGONSTIPPLE), .st = 0, diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index bafd38695f6..7970bcf2b8b 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -72,6 +72,7 @@ update_textures(struct st_context *st) const struct st_tracked_state st_update_texture = { + .name = "st_update_texture", .dirty = { .mesa = _NEW_TEXTURE, .st = 0, diff --git a/src/mesa/state_tracker/st_atom_viewport.c b/src/mesa/state_tracker/st_atom_viewport.c index a70f4c7434e..147aa3c51a7 100644 --- a/src/mesa/state_tracker/st_atom_viewport.c +++ b/src/mesa/state_tracker/st_atom_viewport.c @@ -86,6 +86,7 @@ update_viewport( struct st_context *st ) const struct st_tracked_state st_update_viewport = { + .name = "st_update_viewport", .dirty = { .mesa = _NEW_BUFFERS | _NEW_VIEWPORT, .st = 0, diff --git a/src/mesa/state_tracker/st_atom_vs.c b/src/mesa/state_tracker/st_atom_vs.c index ab7e2ae4bea..a1e6117bde3 100644 --- a/src/mesa/state_tracker/st_atom_vs.c +++ b/src/mesa/state_tracker/st_atom_vs.c @@ -116,6 +116,7 @@ static void update_vs( struct st_context *st ) const struct st_tracked_state st_update_vs = { + .name = "st_update_vs", .dirty = { .mesa = 0, .st = ST_NEW_VERTEX_PROGRAM, diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 9e8015d4c7f..cb34994d778 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -48,6 +48,7 @@ struct st_state_flags { }; struct st_tracked_state { + const char *name; struct st_state_flags dirty; void (*update)( struct st_context *st ); }; -- 2.30.2