Lines Matching full:unit
111 } unit[MAX_TEXTURE_COORD_UNITS]; member
275 const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; in make_state_key()
283 key->unit[i].enabled = 1; in make_state_key()
286 key->unit[i].source_index = texObj->TargetIndex; in make_state_key()
291 key->unit[i].shadow = (format == GL_DEPTH_COMPONENT || in make_state_key()
295 key->unit[i].ModeRGB = comb->ModeRGB; in make_state_key()
296 key->unit[i].ModeA = comb->ModeA; in make_state_key()
297 key->unit[i].ScaleShiftRGB = comb->ScaleShiftRGB; in make_state_key()
298 key->unit[i].ScaleShiftA = comb->ScaleShiftA; in make_state_key()
299 key->unit[i].NumArgsRGB = comb->NumArgsRGB; in make_state_key()
300 key->unit[i].NumArgsA = comb->NumArgsA; in make_state_key()
302 memcpy(key->unit[i].ArgsRGB, comb->ArgsRGB, sizeof comb->ArgsRGB); in make_state_key()
303 memcpy(key->unit[i].ArgsA, comb->ArgsA, sizeof comb->ArgsA); in make_state_key()
329 keySize = sizeof(*key) - sizeof(key->unit) in make_state_key()
330 + key->nr_enabled_units * sizeof(key->unit[0]); in make_state_key()
346 /* Reg containing each texture unit's sampled texture color,
383 GLuint src, GLuint unit) in get_source() argument
390 return new(p->mem_ctx) ir_dereference_variable(p->src_texture[unit]); in get_source()
407 var->data.max_array_access = MAX2(var->data.max_array_access, (int)unit); in get_source()
409 new(p->mem_ctx) ir_constant(unit)); in get_source()
437 GLuint unit, in emit_combine_source() argument
443 src = get_source(p, source, unit); in emit_combine_source()
469 * texture unit's combinder state. When the RGB and A sources and
472 static GLboolean args_match( const struct state_key *key, GLuint unit ) in args_match() argument
474 GLuint i, numArgs = key->unit[unit].NumArgsRGB; in args_match()
477 if (key->unit[unit].ArgsA[i].Source != key->unit[unit].ArgsRGB[i].Source) in args_match()
480 switch (key->unit[unit].ArgsA[i].Operand) { in args_match()
482 switch (key->unit[unit].ArgsRGB[i].Operand) { in args_match()
491 switch (key->unit[unit].ArgsRGB[i].Operand) { in args_match()
518 GLuint unit, in emit_combine() argument
530 src[i] = emit_combine_source( p, unit, opt[i].Source, opt[i].Operand ); in emit_combine()
590 * Generate instructions for one texture unit's env/combiner mode.
593 emit_texenv(texenv_fragment_program *p, GLuint unit) in emit_texenv() argument
599 if (!key->unit[unit].enabled) { in emit_texenv()
603 switch (key->unit[unit].ModeRGB) { in emit_texenv()
605 alpha_shift = key->unit[unit].ScaleShiftA; in emit_texenv()
613 rgb_shift = key->unit[unit].ScaleShiftRGB; in emit_texenv()
614 alpha_shift = key->unit[unit].ScaleShiftA; in emit_texenv()
623 else if (need_saturate(key->unit[unit].ModeRGB)) in emit_texenv()
630 else if (need_saturate(key->unit[unit].ModeA)) in emit_texenv()
641 if (key->unit[unit].ModeRGB == key->unit[unit].ModeA && in emit_texenv()
642 args_match(key, unit)) { in emit_texenv()
643 val = emit_combine(p, unit, in emit_texenv()
644 key->unit[unit].NumArgsRGB, in emit_texenv()
645 key->unit[unit].ModeRGB, in emit_texenv()
646 key->unit[unit].ArgsRGB); in emit_texenv()
653 else if (key->unit[unit].ModeRGB == TEXENV_MODE_DOT3_RGBA_EXT || in emit_texenv()
654 key->unit[unit].ModeRGB == TEXENV_MODE_DOT3_RGBA) { in emit_texenv()
655 ir_rvalue *val = emit_combine(p, unit, in emit_texenv()
656 key->unit[unit].NumArgsRGB, in emit_texenv()
657 key->unit[unit].ModeRGB, in emit_texenv()
658 key->unit[unit].ArgsRGB); in emit_texenv()
668 val = emit_combine(p, unit, in emit_texenv()
669 key->unit[unit].NumArgsRGB, in emit_texenv()
670 key->unit[unit].ModeRGB, in emit_texenv()
671 key->unit[unit].ArgsRGB); in emit_texenv()
677 val = emit_combine(p, unit, in emit_texenv()
678 key->unit[unit].NumArgsA, in emit_texenv()
679 key->unit[unit].ModeA, in emit_texenv()
680 key->unit[unit].ArgsA); in emit_texenv()
719 static void load_texture( texenv_fragment_program *p, GLuint unit ) in load_texture() argument
723 if (p->src_texture[unit]) in load_texture()
726 const GLuint texTarget = p->state->unit[unit].source_index; in load_texture()
729 if (!(p->state->inputs_available & (VARYING_BIT_TEX0 << unit))) { in load_texture()
730 texcoord = get_current_attrib(p, VERT_ATTRIB_TEX0 + unit); in load_texture()
735 ir_rvalue *index = new(p->mem_ctx) ir_constant(unit); in load_texture()
737 tc_array->data.max_array_access = MAX2(tc_array->data.max_array_access, (int)unit); in load_texture()
740 if (!p->state->unit[unit].enabled) { in load_texture()
741 p->src_texture[unit] = p->make_temp(glsl_type::vec4_type, in load_texture()
743 p->emit(p->src_texture[unit]); in load_texture()
745 p->emit(assign(p->src_texture[unit], new(p->mem_ctx) ir_constant(0.0f))); in load_texture()
754 if (p->state->unit[unit].shadow) in load_texture()
761 if (p->state->unit[unit].shadow) in load_texture()
768 if (p->state->unit[unit].shadow) in load_texture()
775 if (p->state->unit[unit].shadow) in load_texture()
782 if (p->state->unit[unit].shadow) in load_texture()
789 assert(!p->state->unit[unit].shadow); in load_texture()
794 if (p->state->unit[unit].shadow) in load_texture()
801 assert(!p->state->unit[unit].shadow); in load_texture()
807 p->src_texture[unit] = p->make_temp(glsl_type::vec4_type, in load_texture()
813 char *sampler_name = ralloc_asprintf(p->mem_ctx, "sampler_%d", unit); in load_texture()
819 /* Set the texture unit for this sampler in the same way that in load_texture()
823 sampler->data.binding = unit; in load_texture()
830 if (p->state->unit[unit].shadow) { in load_texture()
841 p->emit(assign(p->src_texture[unit], tex)); in load_texture()
846 GLuint src, GLuint unit) in load_texenv_source() argument
850 load_texture(p, unit); in load_texenv_source()
875 load_texunit_sources( texenv_fragment_program *p, GLuint unit ) in load_texunit_sources() argument
880 for (i = 0; i < key->unit[unit].NumArgsRGB; i++) { in load_texunit_sources()
881 load_texenv_source( p, key->unit[unit].ArgsRGB[i].Source, unit ); in load_texunit_sources()
884 for (i = 0; i < key->unit[unit].NumArgsA; i++) { in load_texunit_sources()
885 load_texenv_source( p, key->unit[unit].ArgsA[i].Source, unit ); in load_texunit_sources()
978 GLuint unit; in emit_instructions() local
985 for (unit = 0; unit < key->nr_enabled_units; unit++) in emit_instructions()
986 if (key->unit[unit].enabled) { in emit_instructions()
987 load_texunit_sources(p, unit); in emit_instructions()
992 for (unit = 0; unit < key->nr_enabled_units; unit++) { in emit_instructions()
993 if (key->unit[unit].enabled) { in emit_instructions()
994 p->src_previous = emit_texenv(p, unit); in emit_instructions()
1039 unsigned int unit; in create_new_program() local
1083 for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) in create_new_program()
1084 p.src_texture[unit] = NULL; in create_new_program()