Mesa (master): vc4: Add a helper for QOP_R4_UNPACK_[ABCD].

Eric Anholt anholt at kemper.freedesktop.org
Mon Aug 18 22:28:04 UTC 2014


Module: Mesa
Branch: master
Commit: 50b4293eb3f26609c28c37898877d15e3c597702
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=50b4293eb3f26609c28c37898877d15e3c597702

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Aug 18 10:53:35 2014 -0700

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 642595b..f125870 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 c25a58e..e205a53 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 */




More information about the mesa-commit mailing list