mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 15:20:10 +01:00
pan/midgard: Add mir_simple_swizzle helper
Checks for x/xy/xyz/xyzw style swizzles (slightly more general but you get the idea). Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
parent
63385a3fdb
commit
b8caaa3000
1 changed files with 15 additions and 0 deletions
|
|
@ -303,4 +303,19 @@ vector_alu_apply_swizzle(unsigned src, unsigned swizzle)
|
|||
return vector_alu_srco_unsigned(s);
|
||||
}
|
||||
|
||||
/* Checks for an xyzw.. swizzle, given a mask */
|
||||
|
||||
static inline bool
|
||||
mir_is_simple_swizzle(unsigned swizzle, unsigned mask)
|
||||
{
|
||||
for (unsigned i = 0; i < 16; ++i) {
|
||||
if (!(mask & (1 << i))) continue;
|
||||
|
||||
if (((swizzle >> (2 * i)) & 0x3) != i)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue