pan/bi: fix destination of v4i8 instruction returning only v2i8

When v4i8 instruction are using to compute a v2i8, it puts the 2
result values in b0 & b2, thus we need to swizzle the destination to
have them in b0 & b1 as expected by the consumer of the v2i8 produced.

example: dEQP-VK.spirv_assembly.type.vec2.i8.mul_frag

Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36638>
This commit is contained in:
Romaric Jodin 2025-11-14 15:17:46 +01:00 committed by Marge Bot
parent df0cef26f6
commit 6db607651a

View file

@ -3352,6 +3352,12 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr)
bi_index s2 =
srcs > 2 ? bi_alu_src_index(b, instr->src[2], comps) : bi_null();
bool need_post_swizzle = sz == 8 && comps == 2;
bi_index post_swizzle_dst = dst;
if (need_post_swizzle) {
dst = bi_temp(b->shader);
}
switch (instr->op) {
case nir_op_ffma:
bi_fma_to(b, sz, dst, s0, s1, s2);
@ -3927,6 +3933,12 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr)
fprintf(stderr, "Unhandled ALU op %s\n", nir_op_infos[instr->op].name);
UNREACHABLE("Unknown ALU op");
}
if (need_post_swizzle) {
bi_index srcs[2] = {dst, dst};
unsigned channels[2] = {0, 2};
bi_make_vec_to(b, post_swizzle_dst, srcs, channels, 2, 8);
}
}
/* Returns dimension with 0 special casing cubemaps. Shamelessly copied from