static GLboolean run_texmat_stage( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLuint i; if (!ctx->Texture._TexMatEnabled || ctx->VertexProgram._Current) return GL_TRUE; /* ENABLE_TEXMAT implies that the texture matrix is not the * identity, so we don't have to check that here. */ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) { if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) { (void) TransformRaw( &store->texcoord[i], ctx->TextureMatrixStack[i].Top, VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]); VB->TexCoordPtr[i] = VB->AttribPtr[VERT_ATTRIB_TEX0+i] = &store->texcoord[i]; } } return GL_TRUE; }
static void check_texmat( GLcontext *ctx, struct gl_pipeline_stage *stage ) { GLuint i; stage->active = 0; if (ctx->Texture._TexMatEnabled) { GLuint flags = 0; for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) flags |= VERT_TEX(i); stage->active = 1; stage->inputs = flags; stage->outputs = flags; } }
/** * \note This routine refers to derived texture attribute values to * compute the ENABLE_TEXMAT flags, but is only called on * _NEW_TEXTURE_MATRIX. On changes to _NEW_TEXTURE, the ENABLE_TEXMAT * flags are updated by _mesa_update_textures(), below. * * \param ctx GL context. */ static void update_texture_matrices( GLcontext *ctx ) { GLuint u; ctx->Texture._TexMatEnabled = 0x0; for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) { if (_math_matrix_is_dirty(ctx->TextureMatrixStack[u].Top)) { _math_matrix_analyse( ctx->TextureMatrixStack[u].Top ); if (ctx->Texture.Unit[u]._ReallyEnabled && ctx->TextureMatrixStack[u].Top->type != MATRIX_IDENTITY) ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(u); } } }
/** * \note This routine refers to derived texture attribute values to * compute the ENABLE_TEXMAT flags, but is only called on * _NEW_TEXTURE_MATRIX. On changes to _NEW_TEXTURE, the ENABLE_TEXMAT * flags are updated by _mesa_update_textures(), below. * * \param ctx GL context. */ static void update_texture_matrices( struct gl_context *ctx ) { GLuint u; ctx->Texture._TexMatEnabled = 0x0; for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) { assert(u < ARRAY_SIZE(ctx->TextureMatrixStack)); if (_math_matrix_is_dirty(ctx->TextureMatrixStack[u].Top)) { _math_matrix_analyse( ctx->TextureMatrixStack[u].Top ); if (ctx->Texture.Unit[u]._Current && ctx->TextureMatrixStack[u].Top->type != MATRIX_IDENTITY) ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(u); } } }
static GLboolean run_texmat_stage( GLcontext *ctx, struct gl_pipeline_stage *stage ) { struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLuint i; /* ENABLE_TEXMAT implies that the texture matrix is not the * identity, so we don't have to check that here. */ for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) { if (stage->changed_inputs & VERT_TEX(i)) (void) TransformRaw( &store->texcoord[i], &ctx->TextureMatrix[i], VB->TexCoordPtr[i]); VB->TexCoordPtr[i] = &store->texcoord[i]; } return GL_TRUE; }
/* Note: This routine refers to derived texture attribute values to * compute the ENABLE_TEXMAT flags, but is only called on * _NEW_TEXTURE_MATRIX. On changes to _NEW_TEXTURE, the ENABLE_TEXMAT * flags are updated by _mesa_update_textures(), below. * * If both TEXTURE and TEXTURE_MATRIX change at once, these values * will be computed twice. */ static void update_texture_matrices( GLcontext *ctx ) { GLuint i; ctx->Texture._TexMatEnabled = 0; for (i=0; i < ctx->Const.MaxTextureUnits; i++) { if (ctx->TextureMatrix[i].flags & MAT_DIRTY) { _math_matrix_analyse( &ctx->TextureMatrix[i] ); if (ctx->Texture.Unit[i]._ReallyEnabled && ctx->TextureMatrix[i].type != MATRIX_IDENTITY) ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i); if (ctx->Driver.TextureMatrix) ctx->Driver.TextureMatrix( ctx, i, &ctx->TextureMatrix[i] ); } } }
static void update_texgen(struct gl_context *ctx) { GLuint unit; /* Setup texgen for those texture coordinate sets that are in use */ for (unit = 0; unit < ctx->Const.MaxTextureCoordUnits; unit++) { struct gl_fixedfunc_texture_unit *texUnit = &ctx->Texture.FixedFuncUnit[unit]; texUnit->_GenFlags = 0x0; if (!(ctx->Texture._EnabledCoordUnits & (1 << unit))) continue; if (texUnit->TexGenEnabled) { if (texUnit->TexGenEnabled & S_BIT) { texUnit->_GenFlags |= texUnit->GenS._ModeBit; } if (texUnit->TexGenEnabled & T_BIT) { texUnit->_GenFlags |= texUnit->GenT._ModeBit; } if (texUnit->TexGenEnabled & R_BIT) { texUnit->_GenFlags |= texUnit->GenR._ModeBit; } if (texUnit->TexGenEnabled & Q_BIT) { texUnit->_GenFlags |= texUnit->GenQ._ModeBit; } ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit); ctx->Texture._GenFlags |= texUnit->_GenFlags; } assert(unit < ARRAY_SIZE(ctx->TextureMatrixStack)); if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit); } }
static void make_state_key( GLcontext *ctx, struct state_key *key ) { const struct gl_fragment_program *fp; GLuint i; memset(key, 0, sizeof(struct state_key)); fp = ctx->FragmentProgram._Current; /* This now relies on texenvprogram.c being active: */ assert(fp); key->need_eye_coords = ctx->_NeedEyeCoords; key->fragprog_inputs_read = fp->Base.InputsRead; key->varying_vp_inputs = ctx->varying_vp_inputs; if (ctx->RenderMode == GL_FEEDBACK) { /* make sure the vertprog emits color and tex0 */ key->fragprog_inputs_read |= (FRAG_BIT_COL0 | FRAG_BIT_TEX0); } key->separate_specular = (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR); if (ctx->Light.Enabled) { key->light_global_enabled = 1; if (ctx->Light.Model.LocalViewer) key->light_local_viewer = 1; if (ctx->Light.Model.TwoSide) key->light_twoside = 1; if (ctx->Light.ColorMaterialEnabled) { key->light_color_material_mask = ctx->Light.ColorMaterialBitmask; } for (i = 0; i < MAX_LIGHTS; i++) { struct gl_light *light = &ctx->Light.Light[i]; if (light->Enabled) { key->unit[i].light_enabled = 1; if (light->EyePosition[3] == 0.0) key->unit[i].light_eyepos3_is_zero = 1; if (light->SpotCutoff == 180.0) key->unit[i].light_spotcutoff_is_180 = 1; if (light->ConstantAttenuation != 1.0 || light->LinearAttenuation != 0.0 || light->QuadraticAttenuation != 0.0) key->unit[i].light_attenuated = 1; } } if (check_active_shininess(ctx, key, 0)) { key->material_shininess_is_zero = 0; } else if (key->light_twoside && check_active_shininess(ctx, key, 1)) { key->material_shininess_is_zero = 0; } else { key->material_shininess_is_zero = 1; } } if (ctx->Transform.Normalize) key->normalize = 1; if (ctx->Transform.RescaleNormals) key->rescale_normals = 1; if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) key->fog_source_is_depth = 1; if (ctx->Point._Attenuated) key->point_attenuated = 1; #if FEATURE_point_size_array if (ctx->Array.ArrayObj->PointSize.Enabled) key->point_array = 1; #endif if (ctx->Texture._TexGenEnabled || ctx->Texture._TexMatEnabled || ctx->Texture._EnabledUnits) key->texture_enabled_global = 1; for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; if (texUnit->_ReallyEnabled) key->unit[i].texunit_really_enabled = 1; if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) key->unit[i].texmat_enabled = 1; if (texUnit->TexGenEnabled) { key->unit[i].texgen_enabled = 1; key->unit[i].texgen_mode0 = translate_texgen( texUnit->TexGenEnabled & (1<<0), texUnit->GenS.Mode ); key->unit[i].texgen_mode1 = translate_texgen( texUnit->TexGenEnabled & (1<<1), texUnit->GenT.Mode ); key->unit[i].texgen_mode2 = translate_texgen( texUnit->TexGenEnabled & (1<<2), texUnit->GenR.Mode ); key->unit[i].texgen_mode3 = translate_texgen( texUnit->TexGenEnabled & (1<<3), texUnit->GenQ.Mode ); } } }
static void make_state_key( GLcontext *ctx, struct state_key *key ) { struct brw_context *brw = brw_context(ctx); const struct gl_fragment_program *fp = brw->fragment_program; GLuint i; /* This now relies on texenvprogram.c being active: */ assert(fp); memset(key, 0, sizeof(*key)); /* BRW_NEW_FRAGMENT_PROGRAM */ key->fragprog_inputs_read = fp->Base.InputsRead; /* _NEW_LIGHT */ key->separate_specular = (brw->attribs.Light->Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR); /* _NEW_LIGHT */ if (brw->attribs.Light->Enabled) { key->light_global_enabled = 1; if (brw->attribs.Light->Model.LocalViewer) key->light_local_viewer = 1; if (brw->attribs.Light->Model.TwoSide) key->light_twoside = 1; if (brw->attribs.Light->ColorMaterialEnabled) { key->light_color_material = 1; key->light_color_material_mask = brw->attribs.Light->ColorMaterialBitmask; } /* BRW_NEW_INPUT_VARYING */ /* For these programs, material values are stuffed into the * generic slots: */ for (i = 0 ; i < MAT_ATTRIB_MAX ; i++) if (brw->vb.info.varying & (1<<(VERT_ATTRIB_GENERIC0 + i))) key->light_material_mask |= 1<<i; for (i = 0; i < MAX_LIGHTS; i++) { struct gl_light *light = &brw->attribs.Light->Light[i]; if (light->Enabled) { key->unit[i].light_enabled = 1; if (light->EyePosition[3] == 0.0) key->unit[i].light_eyepos3_is_zero = 1; if (light->SpotCutoff == 180.0) key->unit[i].light_spotcutoff_is_180 = 1; if (light->ConstantAttenuation != 1.0 || light->LinearAttenuation != 0.0 || light->QuadraticAttenuation != 0.0) key->unit[i].light_attenuated = 1; } } } /* _NEW_TRANSFORM */ if (brw->attribs.Transform->Normalize) key->normalize = 1; if (brw->attribs.Transform->RescaleNormals) key->rescale_normals = 1; /* BRW_NEW_FRAGMENT_PROGRAM */ key->fog_option = translate_fog_mode(fp->FogOption); if (key->fog_option) key->fragprog_inputs_read |= FRAG_BIT_FOGC; /* _NEW_FOG */ if (brw->attribs.Fog->FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) key->fog_source_is_depth = 1; /* _NEW_HINT, ??? */ if (1) key->tnl_do_vertex_fog = 1; /* _NEW_POINT */ if (brw->attribs.Point->_Attenuated) key->point_attenuated = 1; /* _NEW_TEXTURE */ if (brw->attribs.Texture->_TexGenEnabled || brw->attribs.Texture->_TexMatEnabled || brw->attribs.Texture->_EnabledUnits) key->texture_enabled_global = 1; for (i = 0; i < MAX_TEXTURE_UNITS; i++) { struct gl_texture_unit *texUnit = &brw->attribs.Texture->Unit[i]; if (texUnit->_ReallyEnabled) key->unit[i].texunit_really_enabled = 1; if (brw->attribs.Texture->_TexMatEnabled & ENABLE_TEXMAT(i)) key->unit[i].texmat_enabled = 1; if (texUnit->TexGenEnabled) { key->unit[i].texgen_enabled = 1; key->unit[i].texgen_mode0 = translate_texgen( texUnit->TexGenEnabled & (1<<0), texUnit->GenModeS ); key->unit[i].texgen_mode1 = translate_texgen( texUnit->TexGenEnabled & (1<<1), texUnit->GenModeT ); key->unit[i].texgen_mode2 = translate_texgen( texUnit->TexGenEnabled & (1<<2), texUnit->GenModeR ); key->unit[i].texgen_mode3 = translate_texgen( texUnit->TexGenEnabled & (1<<3), texUnit->GenModeQ ); } } }
static struct state_key *make_state_key( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; const struct gl_fragment_program *fp = ctx->FragmentProgram._Current; struct state_key *key = CALLOC_STRUCT(state_key); GLuint i; /* This now relies on texenvprogram.c being active: */ assert(fp); key->fragprog_inputs_read = fp->Base.InputsRead; key->separate_specular = (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR); if (ctx->Light.Enabled) { key->light_global_enabled = 1; if (ctx->Light.Model.LocalViewer) key->light_local_viewer = 1; if (ctx->Light.Model.TwoSide) key->light_twoside = 1; if (ctx->Light.ColorMaterialEnabled) { key->light_color_material = 1; key->light_color_material_mask = ctx->Light.ColorMaterialBitmask; } for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) if (VB->AttribPtr[i]->stride) key->light_material_mask |= 1<<(i-_TNL_ATTRIB_MAT_FRONT_AMBIENT); for (i = 0; i < MAX_LIGHTS; i++) { struct gl_light *light = &ctx->Light.Light[i]; if (light->Enabled) { key->unit[i].light_enabled = 1; if (light->EyePosition[3] == 0.0) key->unit[i].light_eyepos3_is_zero = 1; if (light->SpotCutoff == 180.0) key->unit[i].light_spotcutoff_is_180 = 1; if (light->ConstantAttenuation != 1.0 || light->LinearAttenuation != 0.0 || light->QuadraticAttenuation != 0.0) key->unit[i].light_attenuated = 1; } } } if (ctx->Transform.Normalize) key->normalize = 1; if (ctx->Transform.RescaleNormals) key->rescale_normals = 1; key->fog_mode = translate_fog_mode(fp->FogOption); if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) key->fog_source_is_depth = 1; if (tnl->_DoVertexFog) key->tnl_do_vertex_fog = 1; if (ctx->Point._Attenuated) key->point_attenuated = 1; if (ctx->Texture._TexGenEnabled || ctx->Texture._TexMatEnabled || ctx->Texture._EnabledUnits) key->texture_enabled_global = 1; for (i = 0; i < MAX_TEXTURE_UNITS; i++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; if (texUnit->_ReallyEnabled) key->unit[i].texunit_really_enabled = 1; if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) key->unit[i].texmat_enabled = 1; if (texUnit->TexGenEnabled) { key->unit[i].texgen_enabled = 1; key->unit[i].texgen_mode0 = translate_texgen( texUnit->TexGenEnabled & (1<<0), texUnit->GenModeS ); key->unit[i].texgen_mode1 = translate_texgen( texUnit->TexGenEnabled & (1<<1), texUnit->GenModeT ); key->unit[i].texgen_mode2 = translate_texgen( texUnit->TexGenEnabled & (1<<2), texUnit->GenModeR ); key->unit[i].texgen_mode3 = translate_texgen( texUnit->TexGenEnabled & (1<<3), texUnit->GenModeQ ); } } return key; }
/* Note: This routine refers to derived texture matrix values to * compute the ENABLE_TEXMAT flags, but is only called on * _NEW_TEXTURE. On changes to _NEW_TEXTURE_MATRIX, the ENABLE_TEXMAT * flags are updated by _mesa_update_texture_matrices, above. * * If both TEXTURE and TEXTURE_MATRIX change at once, these values * will be computed twice. */ static void update_texture_state( GLcontext *ctx ) { GLuint i; ctx->Texture._ReallyEnabled = 0; ctx->Texture._GenFlags = 0; ctx->_NeedNormals &= ~NEED_NORMALS_TEXGEN; ctx->_NeedEyeCoords &= ~NEED_EYE_TEXGEN; ctx->Texture._TexMatEnabled = 0; ctx->Texture._TexGenEnabled = 0; /* Update texture unit state. */ for (i=0; i < ctx->Const.MaxTextureUnits; i++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; texUnit->_ReallyEnabled = 0; texUnit->_GenFlags = 0; if (!texUnit->Enabled) continue; /* Find the texture of highest dimensionality that is enabled * and complete. We'll use it for texturing. */ if (texUnit->Enabled & TEXTURE0_CUBE) { struct gl_texture_object *texObj = texUnit->CurrentCubeMap; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { texUnit->_ReallyEnabled = TEXTURE0_CUBE; texUnit->_Current = texObj; } } if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_3D)) { struct gl_texture_object *texObj = texUnit->Current3D; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { texUnit->_ReallyEnabled = TEXTURE0_3D; texUnit->_Current = texObj; } } if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_RECT)) { struct gl_texture_object *texObj = texUnit->CurrentRect; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { texUnit->_ReallyEnabled = TEXTURE0_RECT; texUnit->_Current = texObj; } } if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_2D)) { struct gl_texture_object *texObj = texUnit->Current2D; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { texUnit->_ReallyEnabled = TEXTURE0_2D; texUnit->_Current = texObj; } } if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_1D)) { struct gl_texture_object *texObj = texUnit->Current1D; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { texUnit->_ReallyEnabled = TEXTURE0_1D; texUnit->_Current = texObj; } } if (!texUnit->_ReallyEnabled) { texUnit->_Current = NULL; continue; } { GLuint flag = texUnit->_ReallyEnabled << (i * NUM_TEXTURE_TARGETS); ctx->Texture._ReallyEnabled |= flag; } if (texUnit->TexGenEnabled) { if (texUnit->TexGenEnabled & S_BIT) { texUnit->_GenFlags |= texUnit->_GenBitS; } if (texUnit->TexGenEnabled & T_BIT) { texUnit->_GenFlags |= texUnit->_GenBitT; } if (texUnit->TexGenEnabled & Q_BIT) { texUnit->_GenFlags |= texUnit->_GenBitQ; } if (texUnit->TexGenEnabled & R_BIT) { texUnit->_GenFlags |= texUnit->_GenBitR; } ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(i); ctx->Texture._GenFlags |= texUnit->_GenFlags; } if (ctx->TextureMatrix[i].type != MATRIX_IDENTITY) ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i); } if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) { ctx->_NeedNormals |= NEED_NORMALS_TEXGEN; ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN; } if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) { ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN; } }
static void make_state_key( struct gl_context *ctx, struct state_key *key ) { const struct gl_program *fp = ctx->FragmentProgram._Current; GLbitfield mask; memset(key, 0, sizeof(struct state_key)); /* This now relies on texenvprogram.c being active: */ assert(fp); key->need_eye_coords = ctx->_NeedEyeCoords; key->fragprog_inputs_read = fp->info.inputs_read; key->varying_vp_inputs = ctx->varying_vp_inputs; if (ctx->RenderMode == GL_FEEDBACK) { /* make sure the vertprog emits color and tex0 */ key->fragprog_inputs_read |= (VARYING_BIT_COL0 | VARYING_BIT_TEX0); } key->separate_specular = (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR); if (ctx->Light.Enabled) { key->light_global_enabled = 1; if (ctx->Light.Model.LocalViewer) key->light_local_viewer = 1; if (ctx->Light.Model.TwoSide) key->light_twoside = 1; if (ctx->Light.ColorMaterialEnabled) { key->light_color_material_mask = ctx->Light._ColorMaterialBitmask; } mask = ctx->Light._EnabledLights; while (mask) { const int i = u_bit_scan(&mask); struct gl_light *light = &ctx->Light.Light[i]; key->unit[i].light_enabled = 1; if (light->EyePosition[3] == 0.0F) key->unit[i].light_eyepos3_is_zero = 1; if (light->SpotCutoff == 180.0F) key->unit[i].light_spotcutoff_is_180 = 1; if (light->ConstantAttenuation != 1.0F || light->LinearAttenuation != 0.0F || light->QuadraticAttenuation != 0.0F) key->unit[i].light_attenuated = 1; } if (check_active_shininess(ctx, key, 0)) { key->material_shininess_is_zero = 0; } else if (key->light_twoside && check_active_shininess(ctx, key, 1)) { key->material_shininess_is_zero = 0; } else { key->material_shininess_is_zero = 1; } } if (ctx->Transform.Normalize) key->normalize = 1; if (ctx->Transform.RescaleNormals) key->rescale_normals = 1; if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) { key->fog_source_is_depth = 1; key->fog_distance_mode = translate_fog_distance_mode(ctx->Fog.FogDistanceMode); } if (ctx->Point._Attenuated) key->point_attenuated = 1; if (ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled) key->point_array = 1; if (ctx->Texture._TexGenEnabled || ctx->Texture._TexMatEnabled || ctx->Texture._MaxEnabledTexImageUnit != -1) key->texture_enabled_global = 1; 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) key->unit[i].texunit_really_enabled = 1; if (ctx->Point.PointSprite) if (ctx->Point.CoordReplace & (1u << i)) key->unit[i].coord_replace = 1; if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) key->unit[i].texmat_enabled = 1; if (texUnit->TexGenEnabled) { key->unit[i].texgen_enabled = 1; key->unit[i].texgen_mode0 = translate_texgen( texUnit->TexGenEnabled & (1<<0), texUnit->GenS.Mode ); key->unit[i].texgen_mode1 = translate_texgen( texUnit->TexGenEnabled & (1<<1), texUnit->GenT.Mode ); key->unit[i].texgen_mode2 = translate_texgen( texUnit->TexGenEnabled & (1<<2), texUnit->GenR.Mode ); key->unit[i].texgen_mode3 = translate_texgen( texUnit->TexGenEnabled & (1<<3), texUnit->GenQ.Mode ); } } }