summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-08-18 10:53:35 -0700
committerEric Anholt <[email protected]>2014-08-18 15:27:43 -0700
commit50b4293eb3f26609c28c37898877d15e3c597702 (patch)
tree646e6cb78407e056cce1d5faae019b7ce8e4e6d3 /src/gallium
parent8795341e2c113176286e9bb6ef3fe716905d7d30 (diff)
vc4: Add a helper for QOP_R4_UNPACK_[ABCD].
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c11
-rw-r--r--src/gallium/drivers/vc4/vc4_qir.h8
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 */