vc4: Add a helper for QOP_R4_UNPACK_[ABCD].

This commit is contained in:
Eric Anholt 2014-08-18 10:53:35 -07:00
parent 8795341e2c
commit 50b4293eb3
2 changed files with 11 additions and 8 deletions

View 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? */
}

View 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 */