On Tue, Jan 20, 2015 at 12:11 AM, Kenneth Graunke <kenn...@whitecape.org> wrote: > On Monday, January 19, 2015 03:31:05 PM Matt Turner wrote: >> --- >> src/mesa/drivers/dri/i965/brw_eu.c | 22 ++++++++++++++++++++++ >> src/mesa/drivers/dri/i965/brw_eu.h | 1 + >> 2 files changed, 23 insertions(+) >> >> diff --git a/src/mesa/drivers/dri/i965/brw_eu.c >> b/src/mesa/drivers/dri/i965/brw_eu.c >> index 9905972..9977eed 100644 >> --- a/src/mesa/drivers/dri/i965/brw_eu.c >> +++ b/src/mesa/drivers/dri/i965/brw_eu.c >> @@ -88,6 +88,28 @@ brw_swap_cmod(uint32_t cmod) >> } >> } >> >> +/* Returns the corresponding inverted conditional mod. */ >> +enum brw_conditional_mod >> +brw_invert_cmod(enum brw_conditional_mod cmod) >> +{ >> + switch (cmod) { >> + case BRW_CONDITIONAL_Z: >> + return BRW_CONDITIONAL_NZ; >> + case BRW_CONDITIONAL_NZ: >> + return BRW_CONDITIONAL_Z; >> + case BRW_CONDITIONAL_G: >> + return BRW_CONDITIONAL_LE; >> + case BRW_CONDITIONAL_GE: >> + return BRW_CONDITIONAL_L; >> + case BRW_CONDITIONAL_L: >> + return BRW_CONDITIONAL_GE; >> + case BRW_CONDITIONAL_LE: >> + return BRW_CONDITIONAL_G; >> + default: >> + return BRW_CONDITIONAL_NONE; >> + } >> +} > > Heh, I thought this looked familiar...apparently I wrote one too :) > http://lists.freedesktop.org/archives/mesa-dev/2014-August/066127.html > > I wasn't sure whether "invert" meant "flip direction" or "negate condition" > until I read the code. How about calling it brw_negate_cmod instead? > > /* Returns a conditional modifier that negates the condition. */ > enum brw_conditional_mod > brw_negate_cmod(uint32_t cmod) > { > ... > } > > Either way is fine. > Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>
Okay, I changed the name, and in the process of thinking about that and a comment Jason made I realized that part of this function was wrong. When you negate, you don't want to swap Z <-> NZ. I've changed the function accordingly: + switch (cmod) { + case BRW_CONDITIONAL_Z: + case BRW_CONDITIONAL_NZ: + return cmod; [snip] _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev