nir/lower_packing: Don't generate nir_pack_32_4x8_split on drivers that can't handle it

It should not be possible for this to happen now as the nir_pack_32_4x8
instruction that is being lowered shouldn't exist. A later commit will
change this.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24741>
This commit is contained in:
Ian Romanick 2023-11-17 11:09:06 -08:00 committed by Marge Bot
parent a76cb87602
commit 7a1a9fb287

View file

@ -89,10 +89,23 @@ lower_unpack_64_to_16(nir_builder *b, nir_def *src)
static nir_def *
lower_pack_32_from_8(nir_builder *b, nir_def *src)
{
return nir_pack_32_4x8_split(b, nir_channel(b, src, 0),
nir_channel(b, src, 1),
nir_channel(b, src, 2),
nir_channel(b, src, 3));
if (b->shader->options->has_pack_32_4x8) {
return nir_pack_32_4x8_split(b,
nir_channel(b, src, 0),
nir_channel(b, src, 1),
nir_channel(b, src, 2),
nir_channel(b, src, 3));
} else {
nir_def *src32 = nir_u2u32(b, src);
return nir_ior(b,
nir_ior(b,
nir_channel(b, src32, 0) ,
nir_ishl_imm(b, nir_channel(b, src32, 1), 8)),
nir_ior(b,
nir_ishl_imm(b, nir_channel(b, src32, 2), 16),
nir_ishl_imm(b, nir_channel(b, src32, 3), 24)));
}
}
static bool