mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
spirv: clamp/sign-extend non 32bit ldexp exponents
GLSL.std.450 allows any integer size here.
OpenCL only allows i32.
Cc: mesa-stable
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34071>
(cherry picked from commit c21a53440f)
This commit is contained in:
parent
1d1fe5cca3
commit
88ea564ece
2 changed files with 13 additions and 2 deletions
|
|
@ -654,7 +654,7 @@
|
|||
"description": "spirv: clamp/sign-extend non 32bit ldexp exponents",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -259,7 +259,6 @@ vtn_nir_alu_op_for_spirv_glsl_opcode(struct vtn_builder *b,
|
|||
case GLSLstd450SMax: return nir_op_imax;
|
||||
case GLSLstd450FMix: return nir_op_flrp;
|
||||
case GLSLstd450Fma: return nir_op_ffma;
|
||||
case GLSLstd450Ldexp: return nir_op_ldexp;
|
||||
case GLSLstd450FindILsb: return nir_op_find_lsb;
|
||||
case GLSLstd450FindSMsb: return nir_op_ifind_msb;
|
||||
case GLSLstd450FindUMsb: return nir_op_ufind_msb;
|
||||
|
|
@ -610,6 +609,18 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
|
|||
dest->def = nir_atan2(nb, src[0], src[1]);
|
||||
break;
|
||||
|
||||
case GLSLstd450Ldexp: {
|
||||
nir_def *exp = src[1];
|
||||
|
||||
if (exp->bit_size == 64) {
|
||||
exp = nir_iclamp(nb, exp, nir_imm_intN_t(nb, INT32_MIN, 64),
|
||||
nir_imm_intN_t(nb, INT32_MAX, 64));
|
||||
}
|
||||
|
||||
dest->def = nir_ldexp(nb, src[0], nir_i2i32(nb, exp));
|
||||
break;
|
||||
}
|
||||
|
||||
case GLSLstd450Frexp: {
|
||||
dest->def = nir_frexp_sig(nb, src[0]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue