From 50b4293eb3f26609c28c37898877d15e3c597702 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 18 Aug 2014 10:53:35 -0700 Subject: [PATCH] vc4: Add a helper for QOP_R4_UNPACK_[ABCD]. --- src/gallium/drivers/vc4/vc4_program.c | 11 +++-------- src/gallium/drivers/vc4/vc4_qir.h | 8 ++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 642595b70d7..f12587028d2 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -347,10 +347,7 @@ tgsi_to_qir_tex(struct tgsi_to_qir *trans, if (!(tgsi_inst->Dst[0].Register.WriteMask & (1 << i))) continue; - struct qreg dst = qir_get_temp(c); - qir_emit(c, qir_inst(QOP_R4_UNPACK_A + i, - dst, - c->undef, c->undef)); + struct qreg dst = qir_R4_UNPACK(c, i); update_dst(trans, tgsi_inst, i, dst); } } @@ -890,10 +887,8 @@ vc4_blend(struct tgsi_to_qir *trans, struct qreg *result, c->undef, c->undef)); struct qreg dst_color[4]; for (int i = 0; i < 4; i++) { - dst_color[i] = qir_get_temp(c); - qir_emit(c, qir_inst(QOP_R4_UNPACK_A + i, - dst_color[i], - c->undef, c->undef)); + dst_color[i] = qir_R4_UNPACK(c, i); + /* XXX: Swizzles? */ } diff --git a/src/gallium/drivers/vc4/vc4_qir.h b/src/gallium/drivers/vc4/vc4_qir.h index c25a58e831e..e205a533385 100644 --- a/src/gallium/drivers/vc4/vc4_qir.h +++ b/src/gallium/drivers/vc4/vc4_qir.h @@ -287,4 +287,12 @@ qir_CMP(struct qcompile *c, struct qreg cmp, struct qreg a, struct qreg b) return t; } +static inline struct qreg +qir_R4_UNPACK(struct qcompile *c, int i) +{ + struct qreg t = qir_get_temp(c); + qir_emit(c, qir_inst(QOP_R4_UNPACK_A + i, t, c->undef, c->undef)); + return t; +} + #endif /* VC4_QIR_H */ -- 2.30.2