[Mesa-dev] [PATCH 15/21] i965: Define consistent interface to predicate an instruction.
Francisco Jerez
currojerez at riseup.net
Tue Apr 28 10:08:31 PDT 2015
---
src/mesa/drivers/dri/i965/brw_ir_fs.h | 22 ++++++++++++++++++++++
src/mesa/drivers/dri/i965/brw_ir_svec4.h | 26 ++++++++++++++++++++++++++
src/mesa/drivers/dri/i965/brw_ir_vec4.h | 22 ++++++++++++++++++++++
3 files changed, 70 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index 1bbe164..b2dfa00 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -329,4 +329,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_svec4.h b/src/mesa/drivers/dri/i965/brw_ir_svec4.h
index f4585d7..58c04c1 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_svec4.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_svec4.h
@@ -381,6 +381,32 @@ namespace brw {
return inst;
}
+
+ /**
+ * Make the execution of \p inst dependent on the evaluation of a possibly
+ * inverted predicate.
+ */
+ inline svec4_inst *
+ exec_predicate_inv(brw_predicate pred, bool inverse,
+ svec4_inst *inst)
+ {
+ for (unsigned i = 0; i < ARRAY_SIZE(inst->v); ++i) {
+ if (inst->v[i])
+ exec_predicate_inv(pred, inverse, inst->v[i]);
+ }
+
+ return inst;
+ }
+
+ /**
+ * Make the execution of \p inst dependent on the evaluation of a
+ * predicate.
+ */
+ inline svec4_inst *
+ exec_predicate(enum brw_predicate pred, svec4_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 1ad57d9..325e661 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
@@ -330,6 +330,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