diff options
author | Eric Anholt <[email protected]> | 2014-10-24 15:03:04 +0100 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-10-24 18:04:26 +0100 |
commit | 52824811b9c0a9bb78a40fcb43af00b315f612d0 (patch) | |
tree | 2b324d8fc3a7037ac3ba57c5c25a4bfbe453b9e1 /src/gallium/drivers/vc4/vc4_qir.c | |
parent | 5d32e263357e562779bfc0d2af712d4c7538a32b (diff) |
vc4: Allow dead code elimination of unused varyings.
total instructions in shared programs: 39022 -> 37341 (-4.31%)
instructions in affected programs: 26979 -> 25298 (-6.23%)
total uniforms in shared programs: 11242 -> 10523 (-6.40%)
uniforms in affected programs: 5836 -> 5117 (-12.32%)
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_qir.c')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_qir.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gallium/drivers/vc4/vc4_qir.c b/src/gallium/drivers/vc4/vc4_qir.c index 9c7c15e4924..a7a4d96f758 100644 --- a/src/gallium/drivers/vc4/vc4_qir.c +++ b/src/gallium/drivers/vc4/vc4_qir.c @@ -122,12 +122,23 @@ qir_get_op_nsrc(enum qop qop) abort(); } +/** + * Returns whether the instruction has any side effects that must be + * preserved. + */ bool -qir_has_side_effects(struct qinst *inst) +qir_has_side_effects(struct vc4_compile *c, struct qinst *inst) { + /* We can dead-code eliminate varyings, because we only tell the VS + * about the live ones at the end. But we have to preserve the + * point/line coordinates reads, because they're generated by + * fixed-function hardware. + */ for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) { - if (inst->src[i].file == QFILE_VARY) + if (inst->src[i].file == QFILE_VARY && + c->input_semantics[inst->src[i].index].semantic == 0xff) { return true; + } } return qir_op_info[inst->op].has_side_effects; |