[Mesa-dev] [PATCH 06/16] i965: Add a brw_invert_cmod() function.
Kenneth Graunke
kenneth at whitecape.org
Tue Jan 20 00:11:53 PST 2015
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 <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150120/3c622f32/attachment.sig>
More information about the mesa-dev
mailing list