X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fstate_tracker%2Fst_atom.c;h=0e22a2fa6e74546563ac9bd883ae2ee8140566cf;hb=6f8286163c79a8187c2912a9b673a6f11f4f60c6;hp=8ac435041d019e16dea47b974f0b82e2a2137f17;hpb=6cb2d0cb71d2019bd2c941a8c042e56275b22c1c;p=mesa.git diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index 8ac435041d0..0e22a2fa6e7 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -29,8 +29,10 @@ #include "glheader.h" #include "context.h" +#include "pipe/p_defines.h" #include "st_context.h" #include "st_atom.h" +#include "st_program.h" @@ -43,16 +45,21 @@ static const struct st_tracked_state *atoms[] = { &st_update_framebuffer, + &st_update_depth_stencil_alpha, &st_update_clip, - &st_update_fs, - &st_update_point, - &st_update_setup, + + &st_update_shader, + + &st_update_rasterizer, + &st_update_polygon_stipple, &st_update_viewport, &st_update_scissor, &st_update_blend, - &st_update_stencil, - /* will be patched out at runtime */ -/* &st_update_constants */ + &st_update_sampler, + &st_update_texture, + &st_update_vs_constants, + &st_update_fs_constants, + &st_update_pixel_transfer }; @@ -66,13 +73,17 @@ void st_init_atoms( struct st_context *st ) /* Patch in a pointer to the dynamic state atom: */ - for (i = 0; i < st->nr_atoms; i++) - if (st->atoms[i] == &st_update_constants) - st->atoms[i] = &st->constants.tracked_state; + 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; + } - memcpy(&st->constants.tracked_state, - &st_update_constants, - sizeof(st_update_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; + } + } } @@ -112,6 +123,21 @@ static void xor_states( struct st_state_flags *result, } +/* Too complex to figure out, just check every time: + */ +static void check_program_state( struct st_context *st ) +{ + GLcontext *ctx = st->ctx; + + if (ctx->VertexProgram._Current != &st->vp->Base) + st->dirty.st |= ST_NEW_VERTEX_PROGRAM; + + if (ctx->FragmentProgram._Current != &st->fp->Base) + st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM; + +} + + /*********************************************************************** * Update all derived state: */ @@ -121,9 +147,13 @@ void st_validate_state( struct st_context *st ) struct st_state_flags *state = &st->dirty; GLuint i; + check_program_state( 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 @@ -136,13 +166,18 @@ void st_validate_state( struct st_context *st ) for (i = 0; i < st->nr_atoms; i++) { 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); - assert(atom->dirty.mesa || - atom->dirty.st); - assert(atom->update); + if (!(atom->dirty.mesa || atom->dirty.st) || + !atom->update) { + _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); @@ -155,6 +190,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;