Mesa (master): spirv: fix GLSLstd450Modf/GLSLstd450Frexp when the destination is vector

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 6 17:31:58 UTC 2020


Module: Mesa
Branch: master
Commit: a0b42da0a2e5a43d8e88605f3678034ad1a2e8a2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0b42da0a2e5a43d8e88605f3678034ad1a2e8a2

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Fri Aug  7 19:24:17 2020 +0100

spirv: fix GLSLstd450Modf/GLSLstd450Frexp when the destination is vector

We can't write to an individual component in a function_temp vector, so we
have to use vtn_variable_store() which does a load+insert+store.

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3484
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6231>

---

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

diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c
index 242f3db02aa..af6b1330563 100644
--- a/src/compiler/spirv/vtn_glsl450.c
+++ b/src/compiler/spirv/vtn_glsl450.c
@@ -339,8 +339,11 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
       nir_ssa_def *sign = nir_fsign(nb, src[0]);
       nir_ssa_def *abs = nir_fabs(nb, src[0]);
       dest->def = nir_fmul(nb, sign, nir_ffract(nb, abs));
-      nir_store_deref(nb, vtn_nir_deref(b, w[6]),
-                      nir_fmul(nb, sign, nir_ffloor(nb, abs)), 0xf);
+
+      struct vtn_pointer *i_ptr = vtn_value(b, w[6], vtn_value_type_pointer)->pointer;
+      struct vtn_ssa_value *whole = vtn_create_ssa_value(b, i_ptr->type->type);
+      whole->def = nir_fmul(nb, sign, nir_ffloor(nb, abs));
+      vtn_variable_store(b, whole, i_ptr, 0);
       break;
    }
 
@@ -526,9 +529,12 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
       break;
 
    case GLSLstd450Frexp: {
-      nir_ssa_def *exponent = nir_frexp_exp(nb, src[0]);
       dest->def = nir_frexp_sig(nb, src[0]);
-      nir_store_deref(nb, vtn_nir_deref(b, w[6]), exponent, 0xf);
+
+      struct vtn_pointer *i_ptr = vtn_value(b, w[6], vtn_value_type_pointer)->pointer;
+      struct vtn_ssa_value *exp = vtn_create_ssa_value(b, i_ptr->type->type);
+      exp->def = nir_frexp_exp(nb, src[0]);
+      vtn_variable_store(b, exp, i_ptr, 0);
       break;
    }
 



More information about the mesa-commit mailing list