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)
{
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:
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,