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

Iago Toral Quiroga itoral at igalia.com
Thu May 17 08:46:27 UTC 2018


---
 src/compiler/spirv/vtn_glsl450.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c
index 6fa759b1bba..ffe12a71818 100644
--- a/src/compiler/spirv/vtn_glsl450.c
+++ b/src/compiler/spirv/vtn_glsl450.c
@@ -540,11 +540,17 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
 
    switch (entrypoint) {
    case GLSLstd450Radians:
-      val->ssa->def = nir_fmul(nb, src[0], nir_imm_float(nb, 0.01745329251));
+      val->ssa->def = nir_fmul(nb, src[0],
+                               nir_imm_floatN_t(nb, 0.01745329251,
+                                                src[0]->bit_size));
       return;
+
    case GLSLstd450Degrees:
-      val->ssa->def = nir_fmul(nb, src[0], nir_imm_float(nb, 57.2957795131));
+      val->ssa->def = nir_fmul(nb, src[0],
+                               nir_imm_floatN_t(nb, 57.2957795131,
+                                                src[0]->bit_size));
       return;
+
    case GLSLstd450Tan:
       val->ssa->def = nir_fdiv(nb, nir_fsin(nb, src[0]),
                                nir_fcos(nb, src[0]));
-- 
2.14.1



More information about the mesa-dev mailing list