vc4: Add a helper function for the construction of qregs.
The separate declaration of the struct is not helping clarity, and I was going to be writing a whole lot more of these in the upcoming patches.
This commit is contained in:
@@ -637,8 +637,8 @@ emit_vertex_input(struct vc4_compile *c, int attr)
|
||||
|
||||
c->vattr_sizes[attr] = align(attr_size, 4);
|
||||
for (int i = 0; i < align(attr_size, 4) / 4; i++) {
|
||||
struct qreg vpm = { QFILE_VPM, attr * 4 + i };
|
||||
c->inputs[attr * 4 + i] = qir_MOV(c, vpm);
|
||||
c->inputs[attr * 4 + i] =
|
||||
qir_MOV(c, qir_reg(QFILE_VPM, attr * 4 + i));
|
||||
c->num_inputs++;
|
||||
}
|
||||
}
|
||||
@@ -1303,8 +1303,7 @@ emit_stub_vpm_read(struct vc4_compile *c)
|
||||
return;
|
||||
|
||||
c->vattr_sizes[0] = 4;
|
||||
struct qreg vpm = { QFILE_VPM, 0 };
|
||||
(void)qir_MOV(c, vpm);
|
||||
(void)qir_MOV(c, qir_reg(QFILE_VPM, 0));
|
||||
c->num_inputs++;
|
||||
}
|
||||
|
||||
|
||||
@@ -448,12 +448,11 @@ qir_uniform(struct vc4_compile *c,
|
||||
for (int i = 0; i < c->num_uniforms; i++) {
|
||||
if (c->uniform_contents[i] == contents &&
|
||||
c->uniform_data[i] == data) {
|
||||
return (struct qreg) { QFILE_UNIF, i };
|
||||
return qir_reg(QFILE_UNIF, i);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t uniform = c->num_uniforms++;
|
||||
struct qreg u = { QFILE_UNIF, uniform };
|
||||
|
||||
if (uniform >= c->uniform_array_size) {
|
||||
c->uniform_array_size = MAX2(MAX2(16, uniform + 1),
|
||||
@@ -470,7 +469,7 @@ qir_uniform(struct vc4_compile *c,
|
||||
c->uniform_contents[uniform] = contents;
|
||||
c->uniform_data[uniform] = data;
|
||||
|
||||
return u;
|
||||
return qir_reg(QFILE_UNIF, uniform);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -486,8 +485,7 @@ qir_SF(struct vc4_compile *c, struct qreg src)
|
||||
if (src.file != QFILE_TEMP ||
|
||||
!c->defs[src.index] ||
|
||||
last_inst != c->defs[src.index]) {
|
||||
struct qreg null = { QFILE_NULL, 0 };
|
||||
last_inst = qir_MOV_dest(c, null, src);
|
||||
last_inst = qir_MOV_dest(c, qir_reg(QFILE_NULL, 0), src);
|
||||
last_inst = (struct qinst *)c->instructions.prev;
|
||||
}
|
||||
last_inst->sf = true;
|
||||
|
||||
@@ -63,6 +63,11 @@ struct qreg {
|
||||
int pack;
|
||||
};
|
||||
|
||||
static inline struct qreg qir_reg(enum qfile file, uint32_t index)
|
||||
{
|
||||
return (struct qreg){file, index};
|
||||
}
|
||||
|
||||
enum qop {
|
||||
QOP_UNDEF,
|
||||
QOP_MOV,
|
||||
@@ -702,8 +707,7 @@ qir_POW(struct vc4_compile *c, struct qreg x, struct qreg y)
|
||||
static inline void
|
||||
qir_VPM_WRITE(struct vc4_compile *c, struct qreg val)
|
||||
{
|
||||
static const struct qreg vpm = { QFILE_VPM, 0 };
|
||||
qir_emit(c, qir_inst(QOP_MOV, vpm, val, c->undef));
|
||||
qir_MOV_dest(c, qir_reg(QFILE_VPM, 0), val);
|
||||
}
|
||||
|
||||
#endif /* VC4_QIR_H */
|
||||
|
||||
@@ -150,7 +150,7 @@ qir_lower_uniforms(struct vc4_compile *c)
|
||||
* reference a temp instead.
|
||||
*/
|
||||
struct qreg temp = qir_get_temp(c);
|
||||
struct qreg unif = { QFILE_UNIF, max_index };
|
||||
struct qreg unif = qir_reg(QFILE_UNIF, max_index);
|
||||
struct qinst *mov = qir_inst(QOP_MOV, temp, unif, c->undef);
|
||||
list_add(&mov->link, &c->instructions);
|
||||
c->defs[temp.index] = mov;
|
||||
|
||||
Reference in New Issue
Block a user