diff options
author | Gustaw Smolarczyk <[email protected]> | 2017-03-30 20:09:26 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-04-08 20:29:58 +0200 |
commit | a86891a9a90d53cc0c333b28b45187cae9ee7bc4 (patch) | |
tree | 16c9816587ebc80e24c4f40ea2e6ab7ed0f31a78 | |
parent | 0e89ab0d6ed92438a1825145483cea428525170c (diff) |
mesa/main/ff_frag: Store nr_enabled_units only once.
Signed-off-by: Gustaw Smolarczyk <[email protected]>
Signed-off-by: Marek Olšák <[email protected]>
-rw-r--r-- | src/mesa/main/ff_fragment_shader.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index 1b76f40e9ad..717f39e9d3e 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -396,8 +396,9 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) /* _NEW_TEXTURE_OBJECT */ mask = ctx->Texture._EnabledCoordUnits; + int i = -1; while (mask) { - const int i = u_bit_scan(&mask); + i = u_bit_scan(&mask); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; const struct gl_texture_object *texObj = texUnit->_Current; const struct gl_tex_env_combine_state *comb = texUnit->_CurrentCombine; @@ -411,7 +412,6 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) format = _mesa_texture_base_format(texObj); key->unit[i].enabled = 1; - key->nr_enabled_units = i + 1; inputs_referenced |= VARYING_BIT_TEX(i); key->unit[i].source_index = _mesa_tex_target_to_index(ctx, @@ -441,6 +441,8 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) } } + key->nr_enabled_units = i + 1; + /* _NEW_LIGHT | _NEW_FOG */ if (texenv_doing_secondary_color(ctx)) { key->separate_specular = 1; |