mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 15:48:36 +02:00
vc4: Refactor shader input setup again.
This makes some space for handling special inputs like fragcoords.
This commit is contained in:
parent
a7faca5d27
commit
d34fbdda12
1 changed files with 24 additions and 17 deletions
|
|
@ -569,6 +569,24 @@ emit_vertex_input(struct tgsi_to_qir *trans, int attr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
emit_fragment_input(struct tgsi_to_qir *trans, int attr)
|
||||||
|
{
|
||||||
|
struct qcompile *c = trans->c;
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
struct qreg vary = {
|
||||||
|
QFILE_VARY,
|
||||||
|
attr * 4 + i
|
||||||
|
};
|
||||||
|
|
||||||
|
/* XXX: multiply by W */
|
||||||
|
trans->inputs[attr * 4 + i] =
|
||||||
|
qir_VARY_ADD_C(c, qir_MOV(c, vary));
|
||||||
|
c->num_inputs++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
emit_tgsi_declaration(struct tgsi_to_qir *trans,
|
emit_tgsi_declaration(struct tgsi_to_qir *trans,
|
||||||
struct tgsi_full_declaration *decl)
|
struct tgsi_full_declaration *decl)
|
||||||
|
|
@ -577,23 +595,12 @@ emit_tgsi_declaration(struct tgsi_to_qir *trans,
|
||||||
|
|
||||||
switch (decl->Declaration.File) {
|
switch (decl->Declaration.File) {
|
||||||
case TGSI_FILE_INPUT:
|
case TGSI_FILE_INPUT:
|
||||||
if (c->stage == QSTAGE_FRAG) {
|
for (int i = decl->Range.First;
|
||||||
for (int i = decl->Range.First * 4;
|
i <= decl->Range.Last;
|
||||||
i < (decl->Range.Last + 1) * 4;
|
i++) {
|
||||||
i++) {
|
if (c->stage == QSTAGE_FRAG) {
|
||||||
struct qreg vary = {
|
emit_fragment_input(trans, i);
|
||||||
QFILE_VARY,
|
} else {
|
||||||
i
|
|
||||||
};
|
|
||||||
trans->inputs[i] =
|
|
||||||
qir_VARY_ADD_C(c, qir_MOV(c, vary));
|
|
||||||
|
|
||||||
c->num_inputs++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = decl->Range.First;
|
|
||||||
i <= decl->Range.Last;
|
|
||||||
i++) {
|
|
||||||
emit_vertex_input(trans, i);
|
emit_vertex_input(trans, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue