[Mesa-dev] [PATCH 06/16] i965: Add a brw_invert_cmod() function.

Matt Turner mattst88 at gmail.com
Mon Jan 19 15:31:05 PST 2015


---
 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;
+   }
+}
+
 void brw_set_default_predicate_control( struct brw_compile *p, unsigned pc )
 {
    brw_inst_set_pred_control(p->brw, p->current, pc);
diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h
index 22d5a0a..42bc9f2 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -447,6 +447,7 @@ void brw_set_src1(struct brw_compile *p, brw_inst *insn, struct brw_reg reg);
 void brw_set_uip_jip(struct brw_compile *p);
 
 enum brw_conditional_mod brw_swap_cmod(uint32_t cmod);
+enum brw_conditional_mod brw_invert_cmod(enum brw_conditional_mod cmod);
 
 /* brw_eu_compact.c */
 void brw_init_compaction_tables(struct brw_context *brw);
-- 
2.0.4



More information about the mesa-dev mailing list