[Mesa-dev] [PATCH 04/29] i965: Define consistent interface to predicate an instruction.

Francisco Jerez currojerez at riseup.net
Sat May 2 08:29:31 PDT 2015


---
 src/mesa/drivers/dri/i965/brw_ir_fs.h   | 22 ++++++++++++++++++++++
 src/mesa/drivers/dri/i965/brw_ir_vec4.h | 22 ++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index 6c65632..9453b5d 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -268,4 +268,26 @@ exec_all(fs_inst *inst)
    return inst;
 }
 
+/**
+ * Make the execution of \p inst dependent on the evaluation of a possibly
+ * inverted predicate.
+ */
+static inline fs_inst *
+exec_predicate_inv(enum brw_predicate pred, bool inverse,
+                   fs_inst *inst)
+{
+   inst->predicate = pred;
+   inst->predicate_inverse = inverse;
+   return inst;
+}
+
+/**
+ * Make the execution of \p inst dependent on the evaluation of a predicate.
+ */
+static inline fs_inst *
+exec_predicate(enum brw_predicate pred, fs_inst *inst)
+{
+   return exec_predicate_inv(pred, false, inst);
+}
+
 #endif
diff --git a/src/mesa/drivers/dri/i965/brw_ir_vec4.h b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
index 48dd90f..60dc8c1 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
@@ -201,6 +201,28 @@ exec_all(vec4_instruction *inst)
    inst->force_writemask_all = true;
    return inst;
 }
+
+/**
+ * Make the execution of \p inst dependent on the evaluation of a possibly
+ * inverted predicate.
+ */
+inline vec4_instruction *
+exec_predicate_inv(enum brw_predicate pred, bool inverse,
+                   vec4_instruction *inst)
+{
+   inst->predicate = pred;
+   inst->predicate_inverse = inverse;
+   return inst;
+}
+
+/**
+ * Make the execution of \p inst dependent on the evaluation of a predicate.
+ */
+inline vec4_instruction *
+exec_predicate(enum brw_predicate pred, vec4_instruction *inst)
+{
+   return exec_predicate_inv(pred, false, inst);
+}
 } /* namespace brw */
 
 #endif
-- 
2.3.5



More information about the mesa-dev mailing list