summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2016-05-22 14:10:19 +0200
committerMathias Fröhlich <[email protected]>2016-06-16 05:50:54 +0200
commit3ee409bebfa88eaec34a7f912a1bbc86304a522f (patch)
tree6a672dbfeff7f127ce8c9aa4bdde89a400c53aaa /src
parentb5820759de6338811dfe0295de34849b41c1c64f (diff)
mesa: Use bitmask/ffs to build ff vertex shader keys.
Replaces an iterate and test bit in a bitmask loop by a loop only iterating over the bits set in the bitmask. The bitmask used here for iteration is a combination of different enabled masks present for texture units. v2: Use _mesa_bit_scan{,64} instead of open coding. v3: Use u_bit_scan{,64} instead of _mesa_bit_scan{,64}. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/ffvertex_prog.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index ca725545f01..f4ae69090ae 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -150,7 +150,6 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key )
{
const struct gl_fragment_program *fp;
GLbitfield mask;
- GLuint i;
memset(key, 0, sizeof(struct state_key));
fp = ctx->FragmentProgram._Current;
@@ -238,7 +237,10 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key )
ctx->Texture._MaxEnabledTexImageUnit != -1)
key->texture_enabled_global = 1;
- for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
+ mask = ctx->Texture._EnabledCoordUnits | ctx->Texture._TexGenEnabled
+ | ctx->Texture._TexMatEnabled | ctx->Point.CoordReplace;
+ while (mask) {
+ const int i = u_bit_scan(&mask);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
if (texUnit->_Current)