From: Francisco Jerez Date: Wed, 3 Jun 2015 18:24:50 +0000 (+0300) Subject: i965: Define consistent interface to enable instruction result saturation. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6e040657292d8d0a6fe8fe7d4d94e9808f29e924;p=mesa.git i965: Define consistent interface to enable instruction result saturation. v2: Use set_ prefix. Reviewed-by: Kenneth Graunke --- 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