mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-22 12:50:35 +01:00
intel/eu/reg: Add a subscript() helper
This is similar to the identically named fs_reg helper.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 10e4feed39)
This commit is contained in:
parent
d1060ba31f
commit
b9ddb51c19
1 changed files with 16 additions and 0 deletions
|
|
@ -896,6 +896,22 @@ spread(struct brw_reg reg, unsigned s)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reinterpret each channel of register \p reg as a vector of values of the
|
||||
* given smaller type and take the i-th subcomponent from each.
|
||||
*/
|
||||
static inline struct brw_reg
|
||||
subscript(struct brw_reg reg, enum brw_reg_type type, unsigned i)
|
||||
{
|
||||
if (reg.file == IMM)
|
||||
return reg;
|
||||
|
||||
unsigned scale = type_sz(reg.type) / type_sz(type);
|
||||
assert(scale >= 1 && i < scale);
|
||||
|
||||
return suboffset(retype(spread(reg, scale), type), i);
|
||||
}
|
||||
|
||||
static inline struct brw_reg
|
||||
vec16(struct brw_reg reg)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue