From f4f39902fd0241162c06065e521151cd2572a34d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Apr 2009 16:47:30 -0600 Subject: st: do away with dynamic state atom for const buffers Just use the new _NEW_PROGRAM_CONSTANTS flag instead. --- src/mesa/state_tracker/st_atom.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'src/mesa/state_tracker/st_atom.c') diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index f79092291b..ff7d388dde 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -37,11 +37,8 @@ -/* This is used to initialize st->atoms[]. We could use this list - * directly except for a single atom, st_update_constants, which has a - * .dirty value which changes according to the parameters of the - * current fragment and vertex programs, and so cannot be a static - * value. +/** + * This is used to initialize st->atoms[]. */ static const struct st_tracked_state *atoms[] = { @@ -67,25 +64,9 @@ static const struct st_tracked_state *atoms[] = void st_init_atoms( struct st_context *st ) { - GLuint i; - st->atoms = _mesa_malloc(sizeof(atoms)); st->nr_atoms = sizeof(atoms)/sizeof(*atoms); memcpy(st->atoms, atoms, sizeof(atoms)); - - /* Patch in a pointer to the dynamic state atom: - */ - for (i = 0; i < st->nr_atoms; i++) { - if (st->atoms[i] == &st_update_vs_constants) { - st->atoms[i] = &st->constants.tracked_state[PIPE_SHADER_VERTEX]; - st->atoms[i][0] = st_update_vs_constants; - } - - if (st->atoms[i] == &st_update_fs_constants) { - st->atoms[i] = &st->constants.tracked_state[PIPE_SHADER_FRAGMENT]; - st->atoms[i][0] = st_update_fs_constants; - } - } } -- cgit v1.2.3 From 3eeefa47d08c91e4d3c14343dd0cab1be4252b8c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Apr 2009 16:50:34 -0600 Subject: st: use the static atoms[] array directly We can simplify this now that we no longer have any dynamic atoms. --- src/mesa/state_tracker/st_atom.c | 23 ++++++++--------------- src/mesa/state_tracker/st_context.h | 5 ----- 2 files changed, 8 insertions(+), 20 deletions(-) (limited to 'src/mesa/state_tracker/st_atom.c') diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index ff7d388dde..ca15ce1b47 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -64,18 +64,13 @@ static const struct st_tracked_state *atoms[] = void st_init_atoms( struct st_context *st ) { - st->atoms = _mesa_malloc(sizeof(atoms)); - st->nr_atoms = sizeof(atoms)/sizeof(*atoms); - memcpy(st->atoms, atoms, sizeof(atoms)); + /* no-op */ } void st_destroy_atoms( struct st_context *st ) { - if (st->atoms) { - _mesa_free(st->atoms); - st->atoms = NULL; - } + /* no-op */ } @@ -153,8 +148,8 @@ void st_validate_state( struct st_context *st ) memset(&examined, 0, sizeof(examined)); prev = *state; - for (i = 0; i < st->nr_atoms; i++) { - const struct st_tracked_state *atom = st->atoms[i]; + for (i = 0; i < Elements(atoms); i++) { + const struct st_tracked_state *atom = atoms[i]; struct st_state_flags generated; // _mesa_printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st); @@ -166,7 +161,7 @@ void st_validate_state( struct st_context *st ) } if (check_state(state, &atom->dirty)) { - st->atoms[i]->update( st ); + atoms[i]->update( st ); // _mesa_printf("after: %x\n", atom->dirty.mesa); } @@ -184,11 +179,9 @@ void st_validate_state( struct st_context *st ) } else { - const GLuint nr = st->nr_atoms; - - for (i = 0; i < nr; i++) { - if (check_state(state, &st->atoms[i]->dirty)) - st->atoms[i]->update( st ); + for (i = 0; i < Elements(atoms); i++) { + if (check_state(state, &atoms[i]->dirty)) + atoms[i]->update( st ); } } diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index ae8c2978bf..f840579a40 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -116,11 +116,6 @@ struct st_context char vendor[100]; char renderer[100]; - /* State to be validated: - */ - struct st_tracked_state **atoms; - GLuint nr_atoms; - struct st_state_flags dirty; GLboolean missing_textures; -- cgit v1.2.3