vc4: Add a helper for QOP_R4_UNPACK_[ABCD].
authorEric Anholt <eric@anholt.net>
Mon, 18 Aug 2014 17:53:35 +0000 (10:53 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 18 Aug 2014 22:27:43 +0000 (15:27 -0700)
src/gallium/drivers/vc4/vc4_program.c
src/gallium/drivers/vc4/vc4_qir.h

index 642595b70d7ff5dcd86e3edb51ca70da255ae1cf..f12587028d2ee3dd0e5e90e2b28b98713f1be04c 100644 (file)
@@ -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? */
         }
 
index c25a58e831e8882fb5da359bfb6a1a7c0b812d62..e205a533385b4ef4c850a3a2e5faa6b791698478 100644 (file)
@@ -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 */