Lines Matching refs:unit
129 } unit[MAX_TEXTURE_UNITS]; member
441 key->unit[i].enabled = 1; in make_state_key()
446 key->unit[i].source_index = in make_state_key()
449 key->unit[i].shadow = in make_state_key()
454 key->unit[i].NumArgsRGB = comb->_NumArgsRGB; in make_state_key()
455 key->unit[i].NumArgsA = comb->_NumArgsA; in make_state_key()
457 key->unit[i].ModeRGB = in make_state_key()
459 key->unit[i].ModeA = in make_state_key()
462 key->unit[i].ScaleShiftRGB = comb->ScaleShiftRGB; in make_state_key()
463 key->unit[i].ScaleShiftA = comb->ScaleShiftA; in make_state_key()
466 key->unit[i].OptRGB[j].Operand = translate_operand(comb->OperandRGB[j]); in make_state_key()
467 key->unit[i].OptA[j].Operand = translate_operand(comb->OperandA[j]); in make_state_key()
468 key->unit[i].OptRGB[j].Source = translate_source(comb->SourceRGB[j]); in make_state_key()
469 key->unit[i].OptA[j].Source = translate_source(comb->SourceA[j]); in make_state_key()
472 if (key->unit[i].ModeRGB == MODE_BUMP_ENVMAP_ATI) { in make_state_key()
474 key->unit[i].NumArgsRGB = 2; in make_state_key()
475 key->unit[i].ScaleShiftRGB = 0; in make_state_key()
476 key->unit[i].OptRGB[0].Operand = OPR_SRC_COLOR; in make_state_key()
477 key->unit[i].OptRGB[0].Source = SRC_TEXTURE; in make_state_key()
478 key->unit[i].OptRGB[1].Operand = OPR_SRC_COLOR; in make_state_key()
479 key->unit[i].OptRGB[1].Source = texUnit->BumpTarget - GL_TEXTURE0 + SRC_TEXTURE0; in make_state_key()
508 keySize = sizeof(*key) - sizeof(key->unit) in make_state_key()
509 + key->nr_enabled_units * sizeof(key->unit[0]); in make_state_key()
568 GLuint src, GLuint unit) in get_source() argument
575 return new(p->mem_ctx) ir_dereference_variable(p->src_texture[unit]); in get_source()
592 var->max_array_access = MAX2(var->max_array_access, unit); in get_source()
594 new(p->mem_ctx) ir_constant(unit)); in get_source()
619 GLuint unit, in emit_combine_source() argument
625 src = get_source(p, source, unit); in emit_combine_source()
657 static GLboolean args_match( const struct state_key *key, GLuint unit ) in args_match() argument
659 GLuint i, numArgs = key->unit[unit].NumArgsRGB; in args_match()
662 if (key->unit[unit].OptA[i].Source != key->unit[unit].OptRGB[i].Source) in args_match()
665 switch (key->unit[unit].OptA[i].Operand) { in args_match()
667 switch (key->unit[unit].OptRGB[i].Operand) { in args_match()
676 switch (key->unit[unit].OptRGB[i].Operand) { in args_match()
703 GLuint unit, in emit_combine() argument
715 src[i] = emit_combine_source( p, unit, opt[i].Source, opt[i].Operand ); in emit_combine()
783 emit_texenv(struct texenv_fragment_program *p, GLuint unit) in emit_texenv() argument
789 if (!key->unit[unit].enabled) { in emit_texenv()
792 if (key->unit[unit].ModeRGB == MODE_BUMP_ENVMAP_ATI) { in emit_texenv()
797 switch (key->unit[unit].ModeRGB) { in emit_texenv()
799 alpha_shift = key->unit[unit].ScaleShiftA; in emit_texenv()
807 rgb_shift = key->unit[unit].ScaleShiftRGB; in emit_texenv()
808 alpha_shift = key->unit[unit].ScaleShiftA; in emit_texenv()
817 else if (need_saturate(key->unit[unit].ModeRGB)) in emit_texenv()
824 else if (need_saturate(key->unit[unit].ModeA)) in emit_texenv()
835 if (key->unit[unit].ModeRGB == key->unit[unit].ModeA && in emit_texenv()
836 args_match(key, unit)) { in emit_texenv()
837 val = emit_combine(p, unit, in emit_texenv()
838 key->unit[unit].NumArgsRGB, in emit_texenv()
839 key->unit[unit].ModeRGB, in emit_texenv()
840 key->unit[unit].OptRGB); in emit_texenv()
847 else if (key->unit[unit].ModeRGB == MODE_DOT3_RGBA_EXT || in emit_texenv()
848 key->unit[unit].ModeRGB == MODE_DOT3_RGBA) { in emit_texenv()
849 ir_rvalue *val = emit_combine(p, unit, in emit_texenv()
850 key->unit[unit].NumArgsRGB, in emit_texenv()
851 key->unit[unit].ModeRGB, in emit_texenv()
852 key->unit[unit].OptRGB); in emit_texenv()
862 val = emit_combine(p, unit, in emit_texenv()
863 key->unit[unit].NumArgsRGB, in emit_texenv()
864 key->unit[unit].ModeRGB, in emit_texenv()
865 key->unit[unit].OptRGB); in emit_texenv()
871 val = emit_combine(p, unit, in emit_texenv()
872 key->unit[unit].NumArgsA, in emit_texenv()
873 key->unit[unit].ModeA, in emit_texenv()
874 key->unit[unit].OptA); in emit_texenv()
912 static void load_texture( struct texenv_fragment_program *p, GLuint unit ) in load_texture() argument
916 if (p->src_texture[unit]) in load_texture()
919 const GLuint texTarget = p->state->unit[unit].source_index; in load_texture()
922 if (!(p->state->inputs_available & (FRAG_BIT_TEX0 << unit))) { in load_texture()
923 texcoord = get_current_attrib(p, VERT_ATTRIB_TEX0 + unit); in load_texture()
924 } else if (p->texcoord_tex[unit]) { in load_texture()
925 texcoord = new(p->mem_ctx) ir_dereference_variable(p->texcoord_tex[unit]); in load_texture()
930 ir_rvalue *index = new(p->mem_ctx) ir_constant(unit); in load_texture()
932 tc_array->max_array_access = MAX2(tc_array->max_array_access, unit); in load_texture()
935 if (!p->state->unit[unit].enabled) { in load_texture()
936 p->src_texture[unit] = p->make_temp(glsl_type::vec4_type, in load_texture()
938 p->emit(p->src_texture[unit]); in load_texture()
940 p->emit(assign(p->src_texture[unit], new(p->mem_ctx) ir_constant(0.0f))); in load_texture()
949 if (p->state->unit[unit].shadow) in load_texture()
956 if (p->state->unit[unit].shadow) in load_texture()
963 if (p->state->unit[unit].shadow) in load_texture()
970 if (p->state->unit[unit].shadow) in load_texture()
977 if (p->state->unit[unit].shadow) in load_texture()
984 assert(!p->state->unit[unit].shadow); in load_texture()
989 if (p->state->unit[unit].shadow) in load_texture()
996 assert(!p->state->unit[unit].shadow); in load_texture()
1002 p->src_texture[unit] = p->make_temp(glsl_type::vec4_type, in load_texture()
1008 char *sampler_name = ralloc_asprintf(p->mem_ctx, "sampler_%d", unit); in load_texture()
1020 sampler->constant_value = new(p->mem_ctx) ir_constant(int(unit)); in load_texture()
1027 if (p->state->unit[unit].shadow) { in load_texture()
1038 p->emit(assign(p->src_texture[unit], tex)); in load_texture()
1043 GLuint src, GLuint unit) in load_texenv_source() argument
1047 load_texture(p, unit); in load_texenv_source()
1072 load_texunit_sources( struct texenv_fragment_program *p, GLuint unit ) in load_texunit_sources() argument
1077 for (i = 0; i < key->unit[unit].NumArgsRGB; i++) { in load_texunit_sources()
1078 load_texenv_source( p, key->unit[unit].OptRGB[i].Source, unit ); in load_texunit_sources()
1081 for (i = 0; i < key->unit[unit].NumArgsA; i++) { in load_texunit_sources()
1082 load_texenv_source( p, key->unit[unit].OptA[i].Source, unit ); in load_texunit_sources()
1092 load_texunit_bumpmap( struct texenv_fragment_program *p, GLuint unit ) in load_texunit_bumpmap() argument
1095 GLuint bumpedUnitNr = key->unit[unit].OptRGB[1].Source - SRC_TEXTURE0; in load_texunit_bumpmap()
1108 tc_array->max_array_access = MAX2(tc_array->max_array_access, unit); in load_texunit_bumpmap()
1110 load_texenv_source( p, unit + SRC_TEXTURE0, unit ); in load_texunit_bumpmap()
1126 bump = get_source(p, key->unit[unit].OptRGB[0].Source, unit); in load_texunit_bumpmap()
1220 GLuint unit; in emit_instructions() local
1224 for (unit = 0; unit < key->nr_enabled_units; unit++) { in emit_instructions()
1225 if (key->unit[unit].enabled && in emit_instructions()
1226 key->unit[unit].ModeRGB == MODE_BUMP_ENVMAP_ATI) { in emit_instructions()
1227 load_texunit_bumpmap(p, unit); in emit_instructions()
1235 for (unit = 0; unit < key->nr_enabled_units; unit++) in emit_instructions()
1236 if (key->unit[unit].enabled) { in emit_instructions()
1237 load_texunit_sources(p, unit); in emit_instructions()
1242 for (unit = 0; unit < key->nr_enabled_units; unit++) { in emit_instructions()
1243 if (key->unit[unit].enabled) { in emit_instructions()
1244 p->src_previous = emit_texenv(p, unit); in emit_instructions()
1289 unsigned int unit; in create_new_program() local
1317 for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { in create_new_program()
1318 p.src_texture[unit] = NULL; in create_new_program()
1319 p.texcoord_tex[unit] = NULL; in create_new_program()