mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 13:38:06 +02:00
pan/bi: Add a bi_op_supports_swizzle() helper
Reviewed-by: Lorenzo Rossi <lorenzo.rossi@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40720>
This commit is contained in:
parent
a8879daf9c
commit
0edceaf383
2 changed files with 13 additions and 3 deletions
|
|
@ -95,6 +95,15 @@ va_op_swizzles(enum bi_opcode op, unsigned src)
|
|||
return swizzles;
|
||||
}
|
||||
|
||||
bool
|
||||
bi_op_supports_swizzle(enum bi_opcode op, unsigned src,
|
||||
enum bi_swizzle swizzle, unsigned arch)
|
||||
{
|
||||
uint32_t supported_swizzles = arch >= 9 ?
|
||||
va_op_swizzles(op, src) : bi_op_swizzles[op][src];
|
||||
return supported_swizzles & BITFIELD_BIT(swizzle);
|
||||
}
|
||||
|
||||
static void
|
||||
lower_swizzle(bi_context *ctx, bi_instr *ins, unsigned src)
|
||||
{
|
||||
|
|
@ -112,9 +121,7 @@ lower_swizzle(bi_context *ctx, bi_instr *ins, unsigned src)
|
|||
return;
|
||||
}
|
||||
|
||||
uint32_t supported_swizzles = pan_arch(ctx->inputs->gpu_id) >= 9 ?
|
||||
va_op_swizzles(ins->op, src) : bi_op_swizzles[ins->op][src];
|
||||
if (supported_swizzles & (1 << ins->src[src].swizzle))
|
||||
if (bi_op_supports_swizzle(ins->op, src, ins->src[src].swizzle, ctx->arch))
|
||||
return;
|
||||
|
||||
/* First, try to apply a given swizzle to a constant to clear the
|
||||
|
|
|
|||
|
|
@ -98,6 +98,9 @@ enum bi_swizzle {
|
|||
BI_SWIZZLE_B33 = BI_SWIZZLE_B3333,
|
||||
};
|
||||
|
||||
bool bi_op_supports_swizzle(enum bi_opcode op, unsigned src,
|
||||
enum bi_swizzle swizzle, unsigned arch);
|
||||
|
||||
static inline void
|
||||
bi_swizzle_to_byte_channels(enum bi_swizzle swizzle, unsigned *channels)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue