[Mesa-dev] [PATCH v2 01/53] compiler/nir: add a nir_b2f() helper

Iago Toral Quiroga itoral at igalia.com
Wed Dec 19 11:50:29 UTC 2018


---
 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.17.1



More information about the mesa-dev mailing list