From 6e040657292d8d0a6fe8fe7d4d94e9808f29e924 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Wed, 3 Jun 2015 21:24:50 +0300 Subject: [PATCH] i965: Define consistent interface to enable instruction result saturation. v2: Use set_ prefix. Reviewed-by: Kenneth Graunke --- 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 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 -- 2.30.2