Lines Matching defs:key

257  * key to identify it.
259 static GLuint make_state_key( struct gl_context *ctx, struct state_key *key )
265 memset(key, 0, sizeof(*key));
280 key->unit[i].enabled = 1;
283 key->unit[i].source_index = texObj->TargetIndex;
288 key->unit[i].shadow = (format == GL_DEPTH_COMPONENT ||
292 key->unit[i].ModeRGB = comb->ModeRGB;
293 key->unit[i].ModeA = comb->ModeA;
294 key->unit[i].ScaleShiftRGB = comb->ScaleShiftRGB;
295 key->unit[i].ScaleShiftA = comb->ScaleShiftA;
296 key->unit[i].NumArgsRGB = comb->NumArgsRGB;
297 key->unit[i].NumArgsA = comb->NumArgsA;
299 memcpy(key->unit[i].ArgsRGB, comb->ArgsRGB, sizeof comb->ArgsRGB);
300 memcpy(key->unit[i].ArgsA, comb->ArgsA, sizeof comb->ArgsA);
303 key->nr_enabled_units = i + 1;
307 key->separate_specular = 1;
312 key->fog_mode = ctx->Fog._PackedEnabledMode;
315 key->num_draw_buffers = ctx->DrawBuffer->_NumColorDrawBuffers;
318 if (ctx->Color.AlphaEnabled && key->num_draw_buffers == 0) {
320 key->num_draw_buffers = 1;
323 key->inputs_available = filter_fp_input_mask(inputs_referenced, ctx);
325 /* compute size of state key, ignoring unused texture units */
326 keySize = sizeof(*key) - sizeof(key->unit)
327 + key->nr_enabled_units * sizeof(key->unit[0]);
468 static GLboolean args_match( const struct state_key *key, GLuint unit )
470 GLuint i, numArgs = key->unit[unit].NumArgsRGB;
473 if (key->unit[unit].ArgsA[i].Source != key->unit[unit].ArgsRGB[i].Source)
476 switch (key->unit[unit].ArgsA[i].Operand) {
478 switch (key->unit[unit].ArgsRGB[i].Operand) {
487 switch (key->unit[unit].ArgsRGB[i].Operand) {
591 const struct state_key *key = p->state;
595 if (!key->unit[unit].enabled) {
599 switch (key->unit[unit].ModeRGB) {
601 alpha_shift = key->unit[unit].ScaleShiftA;
609 rgb_shift = key->unit[unit].ScaleShiftRGB;
610 alpha_shift = key->unit[unit].ScaleShiftA;
619 else if (need_saturate(key->unit[unit].ModeRGB))
626 else if (need_saturate(key->unit[unit].ModeA))
637 if (key->unit[unit].ModeRGB == key->unit[unit].ModeA &&
638 args_match(key, unit)) {
640 key->unit[unit].NumArgsRGB,
641 key->unit[unit].ModeRGB,
642 key->unit[unit].ArgsRGB);
649 else if (key->unit[unit].ModeRGB == TEXENV_MODE_DOT3_RGBA_EXT ||
650 key->unit[unit].ModeRGB == TEXENV_MODE_DOT3_RGBA) {
652 key->unit[unit].NumArgsRGB,
653 key->unit[unit].ModeRGB,
654 key->unit[unit].ArgsRGB);
665 key->unit[unit].NumArgsRGB,
666 key->unit[unit].ModeRGB,
667 key->unit[unit].ArgsRGB);
674 key->unit[unit].NumArgsA,
675 key->unit[unit].ModeA,
676 key->unit[unit].ArgsA);
873 const struct state_key *key = p->state;
876 for (i = 0; i < key->unit[unit].NumArgsRGB; i++) {
877 load_texenv_source( p, key->unit[unit].ArgsRGB[i].Source, unit );
880 for (i = 0; i < key->unit[unit].NumArgsA; i++) {
881 load_texenv_source( p, key->unit[unit].ArgsA[i].Source, unit );
898 struct state_key *key = p->state;
922 switch (key->fog_mode) {
973 struct state_key *key = p->state;
976 if (key->nr_enabled_units) {
981 for (unit = 0; unit < key->nr_enabled_units; unit++)
982 if (key->unit[unit].enabled) {
988 for (unit = 0; unit < key->nr_enabled_units; unit++) {
989 if (key->unit[unit].enabled) {
997 if (key->separate_specular) {
1018 if (key->fog_mode) {
1032 create_new_program(struct gl_context *ctx, struct state_key *key)
1046 p.state = key;
1091 if (key->num_draw_buffers)
1125 struct state_key key;
1128 keySize = make_state_key(ctx, &key);
1132 &key, keySize);
1135 shader_program = create_new_program(ctx, &key);
1138 &key, keySize, shader_program);