add names to tracked state atoms to improve debug

This commit is contained in:
keithw 2007-08-25 22:00:36 +01:00 committed by Keith Whitwell
parent 07d97e80e6
commit 4185da4681
17 changed files with 24 additions and 1 deletions

View File

@ -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;

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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),

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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 );
};