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 <brianp@vmware.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
{
const struct gl_fragment_program *fp;
GLbitfield mask;
- GLuint i;
memset(key, 0, sizeof(struct state_key));
fp = ctx->FragmentProgram._Current;
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)