pan/bi: Return void from bi_swizzle_to_byte_channels()

Reviewed-by: Lorenzo Rossi <lorenzo.rossi@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40720>
This commit is contained in:
Faith Ekstrand 2026-04-01 11:35:41 -04:00 committed by Marge Bot
parent e637130794
commit 4912bda122
3 changed files with 8 additions and 11 deletions

View file

@ -98,7 +98,7 @@ enum bi_swizzle {
BI_SWIZZLE_B33 = BI_SWIZZLE_B3333,
};
static inline bool
static inline void
bi_swizzle_to_byte_channels(enum bi_swizzle swizzle, unsigned *channels)
{
#define B(b0, b1, b2, b3) \
@ -107,7 +107,7 @@ bi_swizzle_to_byte_channels(enum bi_swizzle swizzle, unsigned *channels)
channels[1] = b1; \
channels[2] = b2; \
channels[3] = b3; \
return true; \
return; \
}
switch (swizzle) {
B(0, 1, 0, 1);
@ -133,10 +133,10 @@ bi_swizzle_to_byte_channels(enum bi_swizzle swizzle, unsigned *channels)
B(0, 0, 3, 3);
B(1, 1, 3, 3);
B(1, 1, 2, 3);
default:
return false;
}
#undef B
UNREACHABLE("Invalid bi_swizzle");
}
static inline enum bi_swizzle
@ -365,8 +365,7 @@ static inline bi_index
bi_byte(bi_index idx, unsigned lane)
{
unsigned bytes[4];
bool valid = bi_swizzle_to_byte_channels(idx.swizzle, bytes);
assert(valid);
bi_swizzle_to_byte_channels(idx.swizzle, bytes);
assert(lane < 4);
idx.swizzle = (enum bi_swizzle)(BI_SWIZZLE_B0 + bytes[lane]);

View file

@ -16,9 +16,7 @@ lower_swz_v4i8(bi_builder *b, bi_instr *I)
if (b->shader->arch >= 11) {
bi_index srcs[4] = {I->src[0], I->src[0], I->src[0], I->src[0]};
unsigned channels[4];
ASSERTED bool valid_swizzle =
bi_swizzle_to_byte_channels(I->src[0].swizzle, channels);
assert(valid_swizzle);
bi_swizzle_to_byte_channels(I->src[0].swizzle, channels);
return bi_make_vec_to(b, I->dest[0], srcs, channels, 4, 8);
}

View file

@ -304,8 +304,8 @@ va_propagate_replicate_wide(bi_context *ctx, bi_instr **lut, bi_instr *I)
/* If we have a MKVEC.v2i8 and current instruction only replicate, we
* should propagate */
if (src_ins->op == BI_OPCODE_MKVEC_V2I8 &&
bi_swizzle_replicates_8(src->swizzle) &&
bi_swizzle_to_byte_channels(src->swizzle, tmp)) {
bi_swizzle_replicates_8(src->swizzle)) {
bi_swizzle_to_byte_channels(src->swizzle, tmp);
unsigned byte_idx = *tmp;
/* In case of the top 16-bit, src2 contains the value we want without