vc4: Stop trying to reuse temporaries that store uniform values.
authorEric Anholt <eric@anholt.net>
Mon, 29 Sep 2014 16:39:46 +0000 (09:39 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 29 Sep 2014 17:07:24 +0000 (10:07 -0700)
Almost always, the MOV will get copy propagated out.  Even if it doesn't,
it's probably better to just reload the uniform at next use (to reduce
register pressure) rather than try to save instruction count.

I was looking at this because in the presence of texturing (which calls
add_uniform() directly to get the uniform load forced into the
instruction) the c->uniform_contents indices don't match 1:1 with the
temporary qregs.

src/gallium/drivers/vc4/vc4_program.c
src/gallium/drivers/vc4/vc4_qir.h

index 8d243374dae2645ed9d6d7fdf7b5d5530b6671ee..a5011039be2be5d441d7bfb06a31cdbe50d96301 100644 (file)
@@ -111,19 +111,8 @@ static struct qreg
 get_temp_for_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 c->uniforms[i];
-        }
-
         struct qreg u = add_uniform(c, contents, data);
         struct qreg t = qir_MOV(c, u);
-
-        resize_qreg_array(c, &c->uniforms, &c->uniforms_array_size,
-                          u.index + 1);
-
-        c->uniforms[u.index] = t;
         return t;
 }
 
index 6a2e3c4b2d67596ba65aa3504b3efbeb8095a59b..f771c425415549ef2c19f4a968802492d047a644 100644 (file)
@@ -215,7 +215,6 @@ struct vc4_compile {
         struct qreg *temps;
         struct qreg *inputs;
         struct qreg *outputs;
-        struct qreg *uniforms;
         struct qreg *consts;
         uint32_t temps_array_size;
         uint32_t inputs_array_size;