nir/lower_blend: Fix 32-bit logicops

nir_const_value_for_int asserts signed bounds on the input, but we pass in an
unsigned value that would be out-of-bounds for 32-bit channels, causing the
assert to fail for 32-bit channel formats.

Fixes dEQP-VK.pipeline.monolithic.logic_op.r32_uint.* on AGXV (and probably
PanVK).

Fixes: dbd0615e7a ("nir/lower_blend: Avoid useless iand with logic ops")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24252>
(cherry picked from commit 9c0740211d)
This commit is contained in:
Alyssa Rosenzweig 2023-07-19 18:22:02 -04:00 committed by Eric Engestrom
parent 90d121b65b
commit dfdceef33f
2 changed files with 2 additions and 2 deletions

View file

@ -1309,7 +1309,7 @@
"description": "nir/lower_blend: Fix 32-bit logicops",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "dbd0615e7ad0754ab1057cbfa810c42df971c446"
},

View file

@ -329,7 +329,7 @@ nir_blend_logicop(
nir_const_value mask[4];
for (int i = 0; i < 4; ++i)
mask[i] = nir_const_value_for_int(BITFIELD_MASK(bits[i]), 32);
mask[i] = nir_const_value_for_uint(BITFIELD_MASK(bits[i]), 32);
nir_ssa_def *out = nir_logicop_func(b, options->logicop_func, src, dst,
nir_build_imm(b, 4, 32, mask));