diff options
author | Oliver McFadden <[email protected]> | 2007-05-29 02:58:10 +0000 |
---|---|---|
committer | Oliver McFadden <[email protected]> | 2007-05-30 03:19:26 +0000 |
commit | 705298c281861f49fd4e6af4c6b1ac9d240e3727 (patch) | |
tree | 45d1b9da3095a4bf66c685553dae4bfd2ba3b872 /src/mesa | |
parent | 6439bc5c0d67a0b55773cefaff6769190684120e (diff) |
r300: Cleaned up the state atom checking functions.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_cmdbuf.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index eb5164f2ff9..7055286ba95 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -240,22 +240,28 @@ void r300EmitState(r300ContextPtr r300) r300->hw.all_dirty = GL_FALSE; } -#define CHECK( NM, COUNT ) \ -static int check_##NM( r300ContextPtr r300, \ - struct r300_state_atom* atom ) \ -{ \ - (void) atom; (void) r300; \ - return (COUNT); \ -} - #define packet0_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->packet0.count) #define vpu_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count) -CHECK(always, atom->cmd_size) - CHECK(variable, packet0_count(atom->cmd) ? (1 + packet0_count(atom->cmd)) : 0) - CHECK(vpu, vpu_count(atom->cmd) ? (1 + vpu_count(atom->cmd) * 4) : 0) -#undef packet0_count -#undef vpu_count +static int check_always(r300ContextPtr r300, struct r300_state_atom *atom) +{ + return atom->cmd_size; +} + +static int check_variable(r300ContextPtr r300, struct r300_state_atom *atom) +{ + int cnt; + cnt = packet0_count(atom->cmd); + return cnt ? cnt + 1 : 0; +} + +static int check_vpu(r300ContextPtr r300, struct r300_state_atom *atom) +{ + int cnt; + cnt = vpu_count(atom->cmd); + return cnt ? (cnt * 4) + 1 : 0; +} + #define ALLOC_STATE( ATOM, CHK, SZ, IDX ) \ do { \ r300->hw.ATOM.cmd_size = (SZ); \ |