<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, Dec 19, 2018 at 5:51 AM Iago Toral Quiroga <<a href="mailto:itoral@igalia.com">itoral@igalia.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">v2:<br>
  - use nir_fmul_imm and nir_fadd_imm helpers (Jason)<br>
---<br>
 src/compiler/spirv/vtn_glsl450.c | 23 ++++++++++++++---------<br>
 1 file changed, 14 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c<br>
index b54aeb9b217..f411d17cfe4 100644<br>
--- a/src/compiler/spirv/vtn_glsl450.c<br>
+++ b/src/compiler/spirv/vtn_glsl450.c<br>
@@ -202,17 +202,22 @@ build_log(nir_builder *b, nir_ssa_def *x)<br>
 static nir_ssa_def *<br>
 build_asin(nir_builder *b, nir_ssa_def *x, float p0, float p1)<br>
 {<br>
+   nir_ssa_def *one = nir_imm_floatN_t(b, 1.0f, x->bit_size);<br>
    nir_ssa_def *abs_x = nir_fabs(b, x);<br>
+<br>
+   nir_ssa_def *p0_plus_xp1 = nir_fadd_imm(b, nir_fmul_imm(b, abs_x, p1), p0);<br>
+<br>
+   nir_ssa_def *expr_tail =<br>
+      nir_fadd_imm(b, nir_fmul(b, abs_x,<br>
+                                  nir_fadd_imm(b, nir_fmul(b, abs_x,<br>
+                                                               p0_plus_xp1),<br>
+                                                  M_PI_4f - 1.0f)),<br>
+                      M_PI_2f);<br>
+<br>
    return nir_fmul(b, nir_fsign(b, x),<br>
-                   nir_fsub(b, nir_imm_float(b, M_PI_2f),<br>
-                            nir_fmul(b, nir_fsqrt(b, nir_fsub(b, nir_imm_float(b, 1.0f), abs_x)),<br>
-                                     nir_fadd(b, nir_imm_float(b, M_PI_2f),<br>
-                                              nir_fmul(b, abs_x,<br>
-                                                       nir_fadd(b, nir_imm_float(b, M_PI_4f - 1.0f),<br>
-                                                                nir_fmul(b, abs_x,<br>
-                                                                         nir_fadd(b, nir_imm_float(b, p0),<br>
-                                                                                  nir_fmul(b, abs_x,<br>
-                                                                                           nir_imm_float(b, p1))))))))));<br>
+                      nir_fsub(b, nir_imm_float(b, M_PI_2f),<br></blockquote><div><br></div><div>This needs to be nir_imm_floatN_t.  Fortunately, I don't think it'll line wrap.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+                                  nir_fmul(b, nir_fsqrt(b, nir_fsub(b, one, abs_x)),<br>
+                                                           expr_tail)));<br>
 }<br>
<br>
 /**<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>