From b145b731ab01937993e2bf7ecc072217932568ff Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 27 Apr 2016 18:49:59 -0700 Subject: [PATCH] vc4: Emit only one FRAG_Z or FRAG_W QIR opcode. We were generating piles of FRAG_W for interpolation, only to CSE them away immediately. Since this is the only thing that CSE is doing for us any more, just avoid making the CSE work necessary. --- src/gallium/drivers/vc4/vc4_qir.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/vc4/vc4_qir.h b/src/gallium/drivers/vc4/vc4_qir.h index 789918dee68..62624d4b1e2 100644 --- a/src/gallium/drivers/vc4/vc4_qir.h +++ b/src/gallium/drivers/vc4/vc4_qir.h @@ -374,6 +374,8 @@ struct vc4_compile { struct qreg line_x, point_x, point_y; struct qreg discard; + struct qreg payload_FRAG_Z; + struct qreg payload_FRAG_W; uint8_t vattr_sizes[8]; @@ -584,6 +586,21 @@ qir_##name(struct vc4_compile *c, struct qreg dest, struct qreg a) \ return dest; \ } +#define QIR_PAYLOAD(name) \ +static inline struct qreg \ +qir_##name(struct vc4_compile *c) \ +{ \ + struct qreg *payload = &c->payload_##name; \ + if (payload->file != QFILE_NULL) \ + return *payload; \ + *payload = qir_get_temp(c); \ + struct qinst *inst = qir_inst(QOP_##name, *payload, \ + c->undef, c->undef); \ + list_add(&inst->link, &c->instructions); \ + c->defs[payload->index] = inst; \ + return *payload; \ +} + QIR_ALU1(MOV) QIR_ALU1(FMOV) QIR_ALU1(MMOV) @@ -625,8 +642,8 @@ QIR_NODST_2(TEX_T) QIR_NODST_2(TEX_R) QIR_NODST_2(TEX_B) QIR_NODST_2(TEX_DIRECT) -QIR_ALU0(FRAG_Z) -QIR_ALU0(FRAG_W) +QIR_PAYLOAD(FRAG_Z) +QIR_PAYLOAD(FRAG_W) QIR_ALU0(TEX_RESULT) QIR_ALU0(TLB_COLOR_READ) QIR_NODST_1(MS_MASK) -- 2.30.2