mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 04:00:10 +01:00
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>
This commit is contained in:
parent
81597759be
commit
a0b42da0a2
1 changed files with 10 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue