pan/bi: Add ATEST packing

Only fp32 for now.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4242>
This commit is contained in:
Alyssa Rosenzweig 2020-03-18 23:03:07 -04:00 committed by Marge Bot
parent b18d0ef708
commit e06426ea85
2 changed files with 38 additions and 0 deletions

View file

@ -435,6 +435,26 @@ bi_pack_add_ld_vary(bi_clause *clause, bi_instruction *ins, struct bi_registers
RETURN_PACKED(pack);
}
static unsigned
bi_pack_add_atest(bi_clause *clause, bi_instruction *ins, struct bi_registers *regs)
{
/* TODO: fp16 */
assert(ins->src_types[1] == nir_type_float32);
struct bifrost_add_atest pack = {
.src0 = bi_get_src(ins, regs, 0, false),
.src1 = bi_get_src(ins, regs, 1, false),
.component = 1, /* Set for fp32 */
.op = BIFROST_ADD_OP_ATEST,
};
/* Despite *also* writing with the usual mechanism... quirky and
* perhaps unnecessary, but let's match the blob */
clause->data_register = ins->dest & ~BIR_INDEX_REGISTER;
RETURN_PACKED(pack);
}
static unsigned
bi_pack_add(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs)
{
@ -443,7 +463,9 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs)
switch (bundle.add->type) {
case BI_ADD:
return BIFROST_ADD_NOP;
case BI_ATEST:
return bi_pack_add_atest(clause, bundle.add, regs);
case BI_BRANCH:
case BI_CMP:
case BI_BLEND:

View file

@ -105,6 +105,22 @@ struct bifrost_add_inst {
unsigned op : 17;
} __attribute__((packed));
#define BIFROST_ADD_OP_ATEST (0xc8f)
struct bifrost_add_atest {
/* gl_SampleMask (R60) */
unsigned src0 : 3;
/* Alpha value */
unsigned src1 : 3;
/* If half, X/Y select. If !half, always set */
unsigned component : 1;
unsigned half : 1;
unsigned op : 12;
} __attribute__((packed));
enum bifrost_outmod {
BIFROST_NONE = 0x0,
BIFROST_POS = 0x1,