From: Kenneth Graunke Date: Tue, 29 Dec 2015 23:18:05 +0000 (-0800) Subject: nir/spirv/glsl450: Add a helper for doing fclamp(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=227e2500050de49cfae838bfd99318c3731e253c;p=mesa.git nir/spirv/glsl450: Add a helper for doing fclamp(). --- diff --git a/src/glsl/nir/spirv/vtn_glsl450.c b/src/glsl/nir/spirv/vtn_glsl450.c index d4cb1bb9f3c..f4550baaf93 100644 --- a/src/glsl/nir/spirv/vtn_glsl450.c +++ b/src/glsl/nir/spirv/vtn_glsl450.c @@ -41,6 +41,13 @@ build_length(nir_builder *b, nir_ssa_def *vec) } } +static inline nir_ssa_def * +build_fclamp(nir_builder *b, + nir_ssa_def *x, nir_ssa_def *min_val, nir_ssa_def *max_val) +{ + return nir_fmin(b, nir_fmax(b, x, min_val), max_val); +} + /** * Return e^x. */