From 5fc9ad1cb0f205b3fcf988338bc28a86e2b572b6 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Fri, 14 Dec 2018 08:54:36 +0100 Subject: [PATCH] compiler/nir: add a nir_b2f() helper Reviewed-by: Jason Ekstrand --- src/compiler/nir/nir_builder.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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) -- 2.30.2