From bc1fc9c98539f38f5a29b314d4a993a2e2f7ca0a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 2 Aug 2016 16:01:34 -0700 Subject: vc4: Avoid generating a custom shader per level in glGenerateMipmaps(). We were baking in the LOD of the source level to each shader. Instead, pass it in as a uniform -- this requires storing it to a temp register, but that's better than compiling a ton of separate shaders: total instructions in shared programs: 115032 -> 115036 (0.00%) instructions in affected programs: 96 -> 100 (4.17%) LOST: 572 --- src/gallium/drivers/vc4/vc4_program.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/gallium/drivers/vc4/vc4_program.c') diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 0afd8c6e36e..28b39810756 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -393,8 +393,8 @@ ntq_emit_tex(struct vc4_compile *c, nir_tex_instr *instr) } } - if (c->key->tex[unit].forced_first_level) { - lod = qir_uniform_f(c, c->key->tex[unit].forced_first_level); + if (c->key->tex[unit].force_first_level) { + lod = qir_uniform(c, QUNIFORM_TEXTURE_FIRST_LEVEL, unit); is_txl = true; is_txb = false; } @@ -2353,10 +2353,8 @@ vc4_setup_shared_key(struct vc4_context *vc4, struct vc4_key *key, key->tex[i].compare_func = sampler_state->compare_func; key->tex[i].wrap_s = sampler_state->wrap_s; key->tex[i].wrap_t = sampler_state->wrap_t; - if (vc4_sampler->force_first_level) { - key->tex[i].forced_first_level = - sampler->u.tex.first_level; - } + key->tex[i].force_first_level = + vc4_sampler->force_first_level; } } -- cgit v1.2.3