[Mesa-dev] [PATCH 01/59] compiler/spirv: handle 16-bit float in radians() and degrees()

Iago Toral Quiroga itoral at igalia.com
Tue Dec 4 07:16:25 UTC 2018


Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
 src/compiler/nir/nir_builtin_builder.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_builtin_builder.h b/src/compiler/nir/nir_builtin_builder.h
index 0e5b9db462a..1f5a1a12533 100644
--- a/src/compiler/nir/nir_builtin_builder.h
+++ b/src/compiler/nir/nir_builtin_builder.h
@@ -60,7 +60,9 @@ nir_uclamp(nir_builder *b,
 static inline nir_ssa_def *
 nir_degrees(nir_builder *b, nir_ssa_def *val)
 {
-   return nir_fmul(b, val, nir_imm_float(b, 57.2957795131));
+   return nir_fmul(b, val,
+                   nir_imm_floatN_t(b, 57.2957795131,
+                                    val->bit_size));
 }
 
 static inline nir_ssa_def *
@@ -78,7 +80,9 @@ nir_fast_normalize(nir_builder *b, nir_ssa_def *vec)
 static inline nir_ssa_def *
 nir_radians(nir_builder *b, nir_ssa_def *val)
 {
-   return nir_fmul(b, val, nir_imm_float(b, 0.01745329251));
+   return nir_fmul(b, val,
+                   nir_imm_floatN_t(b, 0.01745329251,
+                                    val->bit_size));
 }
 
 #endif /* NIR_BUILTIN_BUILDER_H */
-- 
2.17.1



More information about the mesa-dev mailing list