Lines Matching defs:tex
2383 create_bindless_texture(nir_shader *nir, nir_tex_instr *tex, unsigned descriptor_set)
2385 unsigned binding = tex->sampler_dim == GLSL_SAMPLER_DIM_BUF ? 1 : 0;
2388 const struct glsl_type *sampler_type = glsl_sampler_type(tex->sampler_dim, tex->is_shadow, tex->is_array, GLSL_TYPE_FLOAT);
2417 nir_tex_instr *tex = nir_instr_as_tex(in);
2418 int idx = nir_tex_instr_src_index(tex, nir_tex_src_texture_handle);
2422 nir_variable *var = tex->sampler_dim == GLSL_SAMPLER_DIM_BUF ? bindless->bindless[1] : bindless->bindless[0];
2424 var = create_bindless_texture(b->shader, tex, bindless->bindless_set);
2428 deref = nir_build_deref_array(b, deref, nir_u2uN(b, tex->src[idx].src.ssa, 32));
2429 nir_instr_rewrite_src_ssa(in, &tex->src[idx].src, &deref->dest.ssa);
2431 /* bindless sampling uses the variable type directly, which means the tex instr has to exactly
2433 * this results in cases where a shader is passed with sampler2DArray but the tex instr only has
2436 * to fix this, pad the coord src here and fix the tex instr so that ntv will do the "right" thing
2440 unsigned c = nir_tex_instr_src_index(tex, nir_tex_src_coord);
2441 unsigned coord_components = nir_src_num_components(tex->src[c].src);
2443 nir_ssa_def *def = nir_pad_vector(b, tex->src[c].src.ssa, needed_components);
2444 nir_instr_rewrite_src_ssa(in, &tex->src[c].src, def);
2445 tex->coord_components = needed_components;
2677 nir_tex_instr *tex = nir_instr_as_tex(instr);
2678 if (tex->sampler_dim != GLSL_SAMPLER_DIM_1D || !tex->is_shadow)
2680 if (tex->is_sparse && screen->need_2D_sparse) {
2685 tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
2687 tex->coord_components++;
2695 unsigned c = nir_tex_instr_src_index(tex, srcs[i]);
2698 if (tex->src[c].src.ssa->num_components == tex->coord_components)
2701 nir_ssa_def *zero = nir_imm_zero(b, 1, tex->src[c].src.ssa->bit_size);
2702 if (tex->src[c].src.ssa->num_components == 1)
2703 def = nir_vec2(b, tex->src[c].src.ssa, zero);
2705 def = nir_vec3(b, nir_channel(b, tex->src[c].src.ssa, 0), zero, nir_channel(b, tex->src[c].src.ssa, 1));
2706 nir_instr_rewrite_src_ssa(instr, &tex->src[c].src, def);
2709 unsigned needed_components = nir_tex_instr_dest_size(tex);
2710 unsigned num_components = tex->dest.ssa.num_components;
2712 tex->dest.ssa.num_components = needed_components;
2716 nir_ssa_def *dst = nir_channels(b, &tex->dest.ssa, mask);
2717 nir_ssa_def_rewrite_uses_after(&tex->dest.ssa, dst, dst->parent_instr);
2750 nir_tex_instr *tex = nir_instr_as_tex(instr);
2751 zs->sinfo.have_sparse |= tex->is_sparse;
2895 nir_tex_instr *tex = nir_instr_as_tex(in);
2896 if (tex->op == nir_texop_txs || tex->op == nir_texop_lod)
2898 int handle = nir_tex_instr_src_index(tex, nir_tex_src_texture_handle);
2901 var = nir_deref_instr_get_variable(nir_src_as_deref(tex->src[handle].src));
2906 if (tex->texture_index >= img->data.driver_location &&
2907 tex->texture_index < img->data.driver_location + size) {
2919 unsigned dest_size = nir_dest_bit_size(tex->dest);
2921 unsigned num_components = nir_dest_num_components(tex->dest);
2922 bool rewrite_depth = tex->is_shadow && num_components > 1 && tex->op != nir_texop_tg4 && !tex->is_sparse;
2925 nir_ssa_def *dest = &tex->dest.ssa;
2927 tex->dest.ssa.bit_size = bit_size;
2928 tex->dest_type = nir_get_nir_type_for_glsl_base_type(ret_type);
2930 assert(!tex->is_new_style_shadow);
2931 tex->dest.ssa.num_components = 1;
2932 tex->is_new_style_shadow = true;
2937 dest = nir_u2uN(b, &tex->dest.ssa, dest_size);
2939 dest = nir_i2iN(b, &tex->dest.ssa, dest_size);
2941 dest = nir_f2fN(b, &tex->dest.ssa, dest_size);
2947 nir_ssa_def_rewrite_uses_after(&tex->dest.ssa, dest, dest->parent_instr);
2949 assert(!tex->is_new_style_shadow);
2950 tex->dest.ssa.num_components = 1;
2951 tex->is_new_style_shadow = true;