diff options
author | Marek Olšák <[email protected]> | 2010-11-09 15:04:34 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2010-11-10 15:14:25 +0100 |
commit | 93c04749be3e4a7e224b5dafe67f479264199908 (patch) | |
tree | 846289853f92c1a66ce6952d78993d175526bc85 /src/gallium/drivers/r300 | |
parent | 1d28936dea2062f89ecd204aabae5bfe06eb943a (diff) |
r300g: turn magic numbers into names in the hyperz code
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r-- | src/gallium/drivers/r300/r300_hyperz.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/gallium/drivers/r300/r300_hyperz.c b/src/gallium/drivers/r300/r300_hyperz.c index 6e0e1b5bf4c..79f7f8abe9b 100644 --- a/src/gallium/drivers/r300/r300_hyperz.c +++ b/src/gallium/drivers/r300/r300_hyperz.c @@ -44,10 +44,10 @@ static bool r300_get_sc_hz_max(struct r300_context *r300) { struct r300_dsa_state *dsa_state = r300->dsa_state.state; - int func = dsa_state->z_stencil_control & 0x7; + int func = dsa_state->z_stencil_control & R300_ZS_MASK; int ret = R300_SC_HYPERZ_MIN; - if (func >= 4 && func <= 7) + if (func >= R300_ZS_GEQUAL && func <= R300_ZS_ALWAYS) ret = R300_SC_HYPERZ_MAX; return ret; } @@ -55,23 +55,26 @@ static bool r300_get_sc_hz_max(struct r300_context *r300) static bool r300_zfunc_same_direction(int func1, int func2) { /* func1 is less/lessthan */ - if (func1 == 1 || func1 == 2) - if (func2 == 3 || func2 == 4 || func2 == 5) + if ((func1 == R300_ZS_LESS || func1 == R300_ZS_LEQUAL) && + (func2 == R300_ZS_EQUAL || func2 == R300_ZS_GEQUAL || + func2 == R300_ZS_GREATER)) return FALSE; - if (func2 == 1 || func2 == 2) - if (func1 == 4 || func1 == 5) + /* func1 is greater/greaterthan */ + if ((func1 == R300_ZS_GEQUAL || func1 == R300_ZS_GREATER) && + (func2 == R300_ZS_LESS || func2 == R300_ZS_LEQUAL)) return FALSE; + return TRUE; } static int r300_get_hiz_min(struct r300_context *r300) { struct r300_dsa_state *dsa_state = r300->dsa_state.state; - int func = dsa_state->z_stencil_control & 0x7; + int func = dsa_state->z_stencil_control & R300_ZS_MASK; int ret = R300_HIZ_MIN; - if (func == 1 || func == 2) + if (func == R300_ZS_LESS || func == R300_ZS_LEQUAL) ret = R300_HIZ_MAX; return ret; } @@ -112,13 +115,16 @@ static boolean r300_can_hiz(struct r300_context *r300) } /* depth comparison function - if just cleared save and return okay */ if (z->current_func == -1) { - int func = dsa_state->z_stencil_control & 0x7; + int func = dsa_state->z_stencil_control & R300_ZS_MASK; if (func != 0 && func != 7) - z->current_func = dsa_state->z_stencil_control & 0x7; + z->current_func = dsa_state->z_stencil_control & R300_ZS_MASK; } else { /* simple don't change */ - if (!r300_zfunc_same_direction(z->current_func, (dsa_state->z_stencil_control & 0x7))) { - DBG(r300, DBG_HYPERZ, "z func changed direction - disabling hyper-z %d -> %d\n", z->current_func, dsa_state->z_stencil_control); + if (!r300_zfunc_same_direction(z->current_func, + (dsa_state->z_stencil_control & R300_ZS_MASK))) { + DBG(r300, DBG_HYPERZ, + "z func changed direction - disabling hyper-z %d -> %d\n", + z->current_func, dsa_state->z_stencil_control); return FALSE; } } |