aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-10-24 17:16:59 +0100
committerEric Anholt <[email protected]>2014-10-24 18:04:26 +0100
commit8c7ac377b7a859705479a0b421d1dacc53ca240a (patch)
tree0406d9f2882f80bcbf07e2c81a50d2fec00eff6a /src/gallium/drivers
parent18ccda7b86b8f7ab7466265aefb3f3e773f4a757 (diff)
vc4: Reuse uniform_data/contents indices when making uniforms.
This allows vc4_opt_cse.c to CSE-away operations involving the same uniform values. total instructions in shared programs: 37341 -> 36906 (-1.16%) instructions in affected programs: 10233 -> 9798 (-4.25%) total uniforms in shared programs: 10523 -> 10320 (-1.93%) uniforms in affected programs: 2467 -> 2264 (-8.23%)
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 0674e4fd01a..c6b7edb9aef 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -114,6 +114,13 @@ add_uniform(struct vc4_compile *c,
enum quniform_contents contents,
uint32_t data)
{
+ 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 };
+ }
+ }
+
uint32_t uniform = c->num_uniforms++;
struct qreg u = { QFILE_UNIF, uniform };