mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
pan/bi: Add a bi_try_compose_swizzles() 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
3b728cb613
commit
a8879daf9c
1 changed files with 16 additions and 0 deletions
|
|
@ -183,6 +183,22 @@ bi_swizzle_from_byte_channels(const unsigned byte_channels[4],
|
|||
}
|
||||
}
|
||||
|
||||
static inline bool
|
||||
bi_try_compose_swizzles(enum bi_swizzle *ab_out,
|
||||
enum bi_swizzle a, enum bi_swizzle b)
|
||||
{
|
||||
unsigned a_bytes[4], b_bytes[4];
|
||||
bi_swizzle_to_byte_channels(a, a_bytes);
|
||||
bi_swizzle_to_byte_channels(b, b_bytes);
|
||||
|
||||
unsigned ab_bytes[4];
|
||||
for (unsigned i = 0; i < 4; i++) {
|
||||
ab_bytes[i] = b_bytes[a_bytes[i]];
|
||||
}
|
||||
|
||||
return bi_swizzle_from_byte_channels(ab_bytes, ab_out);
|
||||
}
|
||||
|
||||
static inline enum bi_swizzle
|
||||
bi_swizzle_from_half(bool x, bool y)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue