summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2015-06-03 21:24:50 +0300
committerFrancisco Jerez <[email protected]>2015-06-09 13:56:06 +0300
commit6e040657292d8d0a6fe8fe7d4d94e9808f29e924 (patch)
tree16616a6e3a7b796d660014621318682003e5d527 /src
parent7624f8410f64a7ce0ba125a2025904c70610c076 (diff)
i965: Define consistent interface to enable instruction result saturation.
v2: Use set_ prefix. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_ir_fs.h11
-rw-r--r--src/mesa/drivers/dri/i965/brw_ir_vec4.h11
2 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index 07af0082d9d..eee4d7e1e00 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -304,4 +304,15 @@ set_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 *
+set_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 96d1cfbeb93..fceacae0e51 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
@@ -223,6 +223,17 @@ set_condmod(enum brw_conditional_mod mod, vec4_instruction *inst)
return inst;
}
+/**
+ * Clamp the result of \p inst to the saturation range of its destination
+ * datatype.
+ */
+inline vec4_instruction *
+set_saturate(bool saturate, vec4_instruction *inst)
+{
+ inst->saturate = saturate;
+ return inst;
+}
+
} /* namespace brw */
#endif