[Mesa-dev] [PATCH 06/29] i965: Define consistent interface to enable instruction result saturation.

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


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

diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index db021a5..0874a2c 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -301,4 +301,15 @@ exec_condmod(enum brw_conditional_mod mod, fs_inst *inst)
    return inst;
 }
 
+/**
+ * Clamp the result of \p inst to the saturation range of its destination
+ * datatype.
+ */
+static inline fs_inst *
+exec_saturate(bool saturate, fs_inst *inst)
+{
+   inst->saturate = saturate;
+   return 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 a90c49d..ebd85f9 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
@@ -234,6 +234,17 @@ exec_condmod(enum brw_conditional_mod mod, vec4_instruction *inst)
    inst->conditional_mod = mod;
    return inst;
 }
+
+/**
+ * Clamp the result of \p inst to the saturation range of its destination
+ * datatype.
+ */
+inline vec4_instruction *
+exec_saturate(bool saturate, vec4_instruction *inst)
+{
+   inst->saturate = saturate;
+   return inst;
+}
 } /* namespace brw */
 
 #endif
-- 
2.3.5



More information about the mesa-dev mailing list