mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
nir: add some swizzle helpers
Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4455>
This commit is contained in:
parent
e78a7a1825
commit
4638a16a93
1 changed files with 20 additions and 0 deletions
|
|
@ -881,6 +881,26 @@ nir_dest_num_components(nir_dest dest)
|
|||
return dest.is_ssa ? dest.ssa.num_components : dest.reg.reg->num_components;
|
||||
}
|
||||
|
||||
/* Are all components the same, ie. .xxxx */
|
||||
static inline bool
|
||||
nir_is_same_comp_swizzle(uint8_t *swiz, unsigned nr_comp)
|
||||
{
|
||||
for (unsigned i = 1; i < nr_comp; i++)
|
||||
if (swiz[i] != swiz[0])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Are all components sequential, ie. .yzw */
|
||||
static inline bool
|
||||
nir_is_sequential_comp_swizzle(uint8_t *swiz, unsigned nr_comp)
|
||||
{
|
||||
for (unsigned i = 1; i < nr_comp; i++)
|
||||
if (swiz[i] != (swiz[0] + i))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void nir_src_copy(nir_src *dest, const nir_src *src, void *instr_or_if);
|
||||
void nir_dest_copy(nir_dest *dest, const nir_dest *src, nir_instr *instr);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue