mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
pan/bi: Add bi_index constructors
These add succinct helpers to generate well-formed references. Note for semantic that bi_zero represents the immediate value #0, while bi_null represents a value that does not exist ("undefined"). Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8215>
This commit is contained in:
parent
99152b6045
commit
5dd756afed
1 changed files with 67 additions and 0 deletions
|
|
@ -415,6 +415,62 @@ typedef struct {
|
|||
enum bi_index_type type : 3;
|
||||
} bi_index;
|
||||
|
||||
static inline bi_index
|
||||
bi_get_index(unsigned value, bool is_reg, unsigned offset)
|
||||
{
|
||||
return (bi_index) {
|
||||
.type = BI_INDEX_NORMAL,
|
||||
.value = value,
|
||||
.swizzle = BI_SWIZZLE_H01,
|
||||
.offset = offset,
|
||||
.reg = is_reg,
|
||||
};
|
||||
}
|
||||
|
||||
static inline bi_index
|
||||
bi_register(unsigned reg)
|
||||
{
|
||||
assert(reg < 64);
|
||||
|
||||
return (bi_index) {
|
||||
.type = BI_INDEX_REGISTER,
|
||||
.swizzle = BI_SWIZZLE_H01,
|
||||
.value = reg
|
||||
};
|
||||
}
|
||||
|
||||
static inline bi_index
|
||||
bi_imm_u32(uint32_t imm)
|
||||
{
|
||||
return (bi_index) {
|
||||
.type = BI_INDEX_CONSTANT,
|
||||
.swizzle = BI_SWIZZLE_H01,
|
||||
.value = imm
|
||||
};
|
||||
}
|
||||
|
||||
static inline bi_index
|
||||
bi_null()
|
||||
{
|
||||
return (bi_index) { .type = BI_INDEX_NULL };
|
||||
}
|
||||
|
||||
static inline bi_index
|
||||
bi_zero()
|
||||
{
|
||||
return bi_imm_u32(0);
|
||||
}
|
||||
|
||||
static inline bi_index
|
||||
bi_passthrough(enum bifrost_packed_src value)
|
||||
{
|
||||
return (bi_index) {
|
||||
.type = BI_INDEX_PASS,
|
||||
.swizzle = BI_SWIZZLE_H01,
|
||||
.value = value
|
||||
};
|
||||
}
|
||||
|
||||
/* Represents the assignment of slots for a given bi_bundle */
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -610,6 +666,17 @@ enum bir_fau {
|
|||
BIR_FAU_HI = (1 << 8),
|
||||
};
|
||||
|
||||
static inline bi_index
|
||||
bi_fau(enum bir_fau value, bool hi)
|
||||
{
|
||||
return (bi_index) {
|
||||
.type = BI_INDEX_FAU,
|
||||
.value = value,
|
||||
.swizzle = BI_SWIZZLE_H01,
|
||||
.offset = hi ? 1 : 0
|
||||
};
|
||||
}
|
||||
|
||||
/* Keep me synced please so we can check src & BIR_SPECIAL */
|
||||
|
||||
#define BIR_SPECIAL (BIR_INDEX_REGISTER | BIR_INDEX_CONSTANT | \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue