static inline void update_single_program_texture_state(struct gl_context *ctx, struct gl_program *prog, int unit, BITSET_WORD *enabled_texture_units) { struct gl_texture_object *texObj; texObj = update_single_program_texture(ctx, prog, unit); _mesa_reference_texobj(&ctx->Texture.Unit[unit]._Current, texObj); BITSET_SET(enabled_texture_units, unit); ctx->Texture._MaxEnabledTexImageUnit = MAX2(ctx->Texture._MaxEnabledTexImageUnit, (int)unit); }
static void update_program_texture_state(struct gl_context *ctx, struct gl_program **prog, BITSET_WORD *enabled_texture_units) { int i; for (i = 0; i < MESA_SHADER_STAGES; i++) { int s; if (!prog[i]) continue; /* We can't only do the shifting trick as the loop condition because if * sampler 31 is active, the next iteration tries to shift by 32, which is * undefined. */ for (s = 0; s < MAX_SAMPLERS && (1 << s) <= prog[i]->SamplersUsed; s++) { struct gl_texture_object *texObj; texObj = update_single_program_texture(ctx, prog[i], s); if (texObj) { int unit = prog[i]->SamplerUnits[s]; _mesa_reference_texobj(&ctx->Texture.Unit[unit]._Current, texObj); BITSET_SET(enabled_texture_units, unit); ctx->Texture._MaxEnabledTexImageUnit = MAX2(ctx->Texture._MaxEnabledTexImageUnit, (int)unit); } } } if (prog[MESA_SHADER_FRAGMENT]) { const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1; ctx->Texture._EnabledCoordUnits |= (prog[MESA_SHADER_FRAGMENT]->InputsRead >> VARYING_SLOT_TEX0) & coordMask; } }