From: Iago Toral Quiroga Date: Fri, 14 Dec 2018 07:54:36 +0000 (+0100) Subject: compiler/nir: add a nir_b2f() helper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5fc9ad1cb0f205b3fcf988338bc28a86e2b572b6;p=mesa.git compiler/nir: add a nir_b2f() helper Reviewed-by: Jason Ekstrand --- diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index 826e549019a..74ecde798d5 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -985,6 +985,18 @@ nir_i2b(nir_builder *build, nir_ssa_def *i) return nir_i2b1(build, i); } +static inline nir_ssa_def * +nir_b2f(nir_builder *build, nir_ssa_def *b, uint32_t bit_size) +{ + switch (bit_size) { + case 64: return nir_b2f64(build, b); + case 32: return nir_b2f32(build, b); + case 16: return nir_b2f16(build, b); + default: + unreachable("Invalid bit-size"); + }; +} + static inline nir_ssa_def * nir_load_barycentric(nir_builder *build, nir_intrinsic_op op, unsigned interp_mode)