diff options
author | Eric Anholt <[email protected]> | 2004-09-30 00:08:05 +0000 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2004-09-30 00:08:05 +0000 |
commit | 7a086dc05e665a78f7e9d069aa4fc70e844b8988 (patch) | |
tree | f7ef0c3e7354f494cea48f10ae86810dd442c63f /src/mesa/drivers/dri/r200/r200_cmdbuf.c | |
parent | fa569c0a73576d3cca7cd1d0363064be099a6a22 (diff) |
OK, one more time. Simplify the state-backup system by just storing the full
state in a ready-to-emit cmdbuf, which avoids the issue Nicolai Haehnle reported
where the check() could return differently during backup-and-emit than it should
have if it were called at the right time. Move the lit emission before most of
the TCL state emission on r200, which fixes neverball issues.
Tested with: r100/r200 with neverball, tuxracer, chromium, quake3, ipers
Diffstat (limited to 'src/mesa/drivers/dri/r200/r200_cmdbuf.c')
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_cmdbuf.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index 384c1634ea0..5cdb3657f98 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -92,18 +92,38 @@ void r200SetUpAtomList( r200ContextPtr rmesa ) insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.tex[i] ); for (i = 0; i < mtu; ++i) insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.cube[i] ); + for (i = 0; i < 6; ++i) + insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.pix[i] ); + + for (i = 0; i < 8; ++i) + insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.lit[i] ); for (i = 0; i < 3 + mtu; ++i) insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.mat[i] ); insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.eye ); insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.glt ); for (i = 0; i < 2; ++i) insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.mtl[i] ); - for (i = 0; i < 8; ++i) - insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.lit[i] ); for (i = 0; i < 6; ++i) insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.ucp[i] ); - for (i = 0; i < 6; ++i) - insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.pix[i] ); +} + +static void r200SaveHwState( r200ContextPtr rmesa ) +{ + struct r200_state_atom *atom; + char * dest = rmesa->backup_store.cmd_buf; + + rmesa->backup_store.cmd_used = 0; + + foreach( atom, &rmesa->hw.atomlist ) { + if ( atom->check( rmesa->glCtx, atom->idx ) ) { + int size = atom->cmd_size * 4; + memcpy( dest, atom->cmd, size); + dest += size; + rmesa->backup_store.cmd_used += size; + } + } + + assert( rmesa->backup_store.cmd_used <= R200_CMD_BUF_SZ ); } void r200EmitState( r200ContextPtr rmesa ) @@ -115,6 +135,11 @@ void r200EmitState( r200ContextPtr rmesa ) if (R200_DEBUG & (DEBUG_STATE|DEBUG_PRIMS)) fprintf(stderr, "%s\n", __FUNCTION__); + if (rmesa->save_on_next_emit) { + r200SaveHwState(rmesa); + rmesa->save_on_next_emit = GL_FALSE; + } + if (!rmesa->hw.is_dirty && !rmesa->hw.all_dirty) return; |