diff options
author | Eric Anholt <[email protected]> | 2014-10-09 14:42:14 +0200 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-10-09 21:47:06 +0200 |
commit | 40748cf8d9b9f4d72bcfb9872d891c1705a81b8d (patch) | |
tree | 8349fb5dba0f18a1df19bdd74179e18f95f00d7d /src | |
parent | b73cab6826b54cdfa138aefb476f1f0d42b87b6a (diff) |
vc4: Eliminate unused texture instructions.
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_opt_dead_code.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/gallium/drivers/vc4/vc4_opt_dead_code.c b/src/gallium/drivers/vc4/vc4_opt_dead_code.c index 0c273fff8f5..f08818adc95 100644 --- a/src/gallium/drivers/vc4/vc4_opt_dead_code.c +++ b/src/gallium/drivers/vc4/vc4_opt_dead_code.c @@ -52,6 +52,8 @@ qir_opt_dead_code(struct vc4_compile *c) bool progress = false; bool *used = calloc(c->num_temps, sizeof(bool)); bool sf_used = false; + /* Whether we're eliminating texture setup currently. */ + bool dce_tex = false; struct simple_node *node, *t; for (node = c->instructions.prev, t = node->prev; @@ -61,7 +63,13 @@ qir_opt_dead_code(struct vc4_compile *c) if (inst->dst.file == QFILE_TEMP && !used[inst->dst.index] && - !qir_has_side_effects(inst)) { + (!qir_has_side_effects(inst) || + inst->op == QOP_TEX_RESULT)) { + if (inst->op == QOP_TEX_RESULT) { + dce_tex = true; + c->num_texture_samples--; + } + dce(c, inst); progress = true; continue; @@ -78,6 +86,18 @@ qir_opt_dead_code(struct vc4_compile *c) sf_used = false; } + if (inst->op == QOP_TEX_RESULT) + dce_tex = false; + + if (dce_tex && (inst->op == QOP_TEX_S || + inst->op == QOP_TEX_T || + inst->op == QOP_TEX_R || + inst->op == QOP_TEX_B)) { + dce(c, inst); + progress = true; + continue; + } + for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) { if (inst->src[i].file == QFILE_TEMP) used[inst->src[i].index] = true; |