struct qreg *uniforms;
struct qreg *consts;
struct qreg line_x, point_x, point_y;
+ struct qreg discard;
uint32_t num_consts;
}
}
+static void
+tgsi_to_qir_kill_if(struct tgsi_to_qir *trans, struct qreg *src, int i)
+{
+ struct qcompile *c = trans->c;
+
+ if (trans->discard.file == QFILE_NULL)
+ trans->discard = qir_uniform_f(trans, 0.0);
+ trans->discard = qir_CMP(c,
+ src[0 * 4 + i],
+ qir_uniform_f(trans, 1.0),
+ trans->discard);
+}
+
static void
emit_fragcoord_input(struct tgsi_to_qir *trans, int attr)
{
tgsi_to_qir_tex(trans, tgsi_inst,
op_trans[tgsi_op].op, src_regs);
return;
+ case TGSI_OPCODE_KILL:
+ trans->discard = qir_uniform_f(trans, 1.0);
+ return;
+ case TGSI_OPCODE_KILL_IF:
+ for (int i = 0; i < 4; i++)
+ tgsi_to_qir_kill_if(trans, src_regs, i);
+ return;
default:
break;
}
format_swiz[i]);
}
+ if (trans->discard.file != QFILE_NULL)
+ qir_TLB_DISCARD_SETUP(c, trans->discard);
+
if (trans->fs_key->depth_enabled) {
qir_emit(c, qir_inst(QOP_TLB_PASSTHROUGH_Z_WRITE, c->undef,
c->undef, c->undef));
[QOP_PACK_SCALED] = { "pack_scaled", 1, 2 },
[QOP_VPM_WRITE] = { "vpm_write", 0, 1, true },
[QOP_VPM_READ] = { "vpm_read", 0, 1, true },
+ [QOP_TLB_DISCARD_SETUP] = { "discard", 0, 1, true },
[QOP_TLB_PASSTHROUGH_Z_WRITE] = { "tlb_passthrough_z", 0, 0, true },
[QOP_TLB_COLOR_WRITE] = { "tlb_color", 0, 1, true },
[QOP_TLB_COLOR_READ] = { "tlb_color_read", 0, 0, true },
QOP_PACK_COLORS,
QOP_VPM_WRITE,
QOP_VPM_READ,
+ QOP_TLB_DISCARD_SETUP,
QOP_TLB_PASSTHROUGH_Z_WRITE,
QOP_TLB_COLOR_WRITE,
QOP_TLB_COLOR_READ,
QIR_ALU0(FRAG_Y)
QIR_ALU0(FRAG_Z)
QIR_ALU0(FRAG_RCP_W)
+QIR_NODST_1(TLB_DISCARD_SETUP)
static inline struct qreg
qir_CMP(struct qcompile *c, struct qreg cmp, struct qreg a, struct qreg b)
int *reg_allocated = calloc(c->num_temps, sizeof(*reg_allocated));
int *reg_uses_remaining =
calloc(c->num_temps, sizeof(*reg_uses_remaining));
+ bool discard = false;
for (int i = 0; i < ARRAY_SIZE(reg_in_use); i++)
reg_in_use[i] = false;
qpu_m_NOP()));
break;
+ case QOP_TLB_DISCARD_SETUP:
+ discard = true;
+ queue(c, qpu_inst(qpu_a_MOV(src[0], src[0]),
+ qpu_m_NOP()));
+ *last_inst(c) |= QPU_SF;
+ break;
+
case QOP_TLB_PASSTHROUGH_Z_WRITE:
queue(c, qpu_inst(qpu_a_MOV(qpu_ra(QPU_W_TLB_Z),
qpu_rb(QPU_R_FRAG_PAYLOAD_ZW)),
qpu_m_NOP()));
+ if (discard) {
+ *last_inst(c) = qpu_set_cond_add(*last_inst(c),
+ QPU_COND_ZS);
+ }
break;
case QOP_TLB_COLOR_READ:
queue(c, qpu_inst(qpu_a_MOV(qpu_tlbc(),
src[0]),
qpu_m_NOP()));
+ if (discard) {
+ *last_inst(c) = qpu_set_cond_add(*last_inst(c),
+ QPU_COND_ZS);
+ }
break;
case QOP_VARY_ADD_C: