summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRhys Perry <pendingchaos02@gmail.com>2020-08-07 19:24:17 +0100
committerDylan Baker <dylan.c.baker@intel.com>2020-12-14 10:44:48 -0800
commite7d790faa780a8a700df6626a3750e0a0ffefbd9 (patch)
treedca7641b3c1e0b4026a69b8659d67fcab0571c76
parentb3e977dd6b6e9ec9b341eae6acbf4883dbc7eea3 (diff)
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@gmail.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@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>
-rw-r--r--src/compiler/spirv/vtn_glsl450.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c
index 242f3db02aa..9b70c70311c 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);
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);
break;
}