• Home
  • Raw
  • Download

Lines Matching refs:tex

70 project_src(nir_builder *b, nir_tex_instr *tex)  in project_src()  argument
73 int proj_index = nir_tex_instr_src_index(tex, nir_tex_src_projector); in project_src()
77 b->cursor = nir_before_instr(&tex->instr); in project_src()
80 nir_frcp(b, nir_ssa_for_src(b, tex->src[proj_index].src, 1)); in project_src()
83 for (unsigned i = 0; i < tex->num_srcs; i++) { in project_src()
84 switch (tex->src[i].src_type) { in project_src()
92 nir_ssa_for_src(b, tex->src[i].src, nir_tex_instr_src_size(tex, i)); in project_src()
98 if (tex->is_array && tex->src[i].src_type == nir_tex_src_coord) { in project_src()
99 switch (tex->coord_components) { in project_src()
124 nir_instr_rewrite_src(&tex->instr, in project_src()
125 &tex->src[i].src, in project_src()
129 nir_tex_instr_remove_src(tex, proj_index); in project_src()
134 lower_offset(nir_builder *b, nir_tex_instr *tex) in lower_offset() argument
136 int offset_index = nir_tex_instr_src_index(tex, nir_tex_src_offset); in lower_offset()
140 int coord_index = nir_tex_instr_src_index(tex, nir_tex_src_coord); in lower_offset()
143 assert(tex->src[offset_index].src.is_ssa); in lower_offset()
144 assert(tex->src[coord_index].src.is_ssa); in lower_offset()
145 nir_ssa_def *offset = tex->src[offset_index].src.ssa; in lower_offset()
146 nir_ssa_def *coord = tex->src[coord_index].src.ssa; in lower_offset()
148 b->cursor = nir_before_instr(&tex->instr); in lower_offset()
151 if (nir_tex_instr_src_type(tex, coord_index) == nir_type_float) { in lower_offset()
152 if (tex->sampler_dim == GLSL_SAMPLER_DIM_RECT) { in lower_offset()
155 nir_ssa_def *txs = nir_i2f32(b, nir_get_texture_size(b, tex)); in lower_offset()
167 if (tex->is_array) { in lower_offset()
169 if (tex->coord_components == 2) { in lower_offset()
172 } else if (tex->coord_components == 3) { in lower_offset()
181 nir_instr_rewrite_src(&tex->instr, &tex->src[coord_index].src, in lower_offset()
184 nir_tex_instr_remove_src(tex, offset_index); in lower_offset()
190 lower_rect(nir_builder *b, nir_tex_instr *tex) in lower_rect() argument
195 tex->sampler_dim = GLSL_SAMPLER_DIM_2D; in lower_rect()
197 nir_ssa_def *txs = nir_i2f32(b, nir_get_texture_size(b, tex)); in lower_rect()
201 for (unsigned i = 0; i < tex->num_srcs; i++) { in lower_rect()
202 if (tex->src[i].src_type != nir_tex_src_coord) in lower_rect()
206 nir_ssa_for_src(b, tex->src[i].src, tex->coord_components); in lower_rect()
207 nir_instr_rewrite_src(&tex->instr, in lower_rect()
208 &tex->src[i].src, in lower_rect()
214 lower_implicit_lod(nir_builder *b, nir_tex_instr *tex) in lower_implicit_lod() argument
216 assert(tex->op == nir_texop_tex || tex->op == nir_texop_txb); in lower_implicit_lod()
217 assert(nir_tex_instr_src_index(tex, nir_tex_src_lod) < 0); in lower_implicit_lod()
218 assert(nir_tex_instr_src_index(tex, nir_tex_src_ddx) < 0); in lower_implicit_lod()
219 assert(nir_tex_instr_src_index(tex, nir_tex_src_ddy) < 0); in lower_implicit_lod()
221 b->cursor = nir_before_instr(&tex->instr); in lower_implicit_lod()
223 nir_ssa_def *lod = nir_get_texture_lod(b, tex); in lower_implicit_lod()
225 int bias_idx = nir_tex_instr_src_index(tex, nir_tex_src_bias); in lower_implicit_lod()
228 lod = nir_fadd(b, lod, nir_ssa_for_src(b, tex->src[bias_idx].src, 1)); in lower_implicit_lod()
229 nir_tex_instr_remove_src(tex, bias_idx); in lower_implicit_lod()
232 int min_lod_idx = nir_tex_instr_src_index(tex, nir_tex_src_min_lod); in lower_implicit_lod()
235 lod = nir_fmax(b, lod, nir_ssa_for_src(b, tex->src[min_lod_idx].src, 1)); in lower_implicit_lod()
236 nir_tex_instr_remove_src(tex, min_lod_idx); in lower_implicit_lod()
239 nir_tex_instr_add_src(tex, nir_tex_src_lod, nir_src_for_ssa(lod)); in lower_implicit_lod()
240 tex->op = nir_texop_txl; in lower_implicit_lod()
244 sample_plane(nir_builder *b, nir_tex_instr *tex, int plane, in sample_plane() argument
247 assert(tex->dest.is_ssa); in sample_plane()
248 assert(nir_tex_instr_dest_size(tex) == 4); in sample_plane()
249 assert(nir_alu_type_get_base_type(tex->dest_type) == nir_type_float); in sample_plane()
250 assert(tex->op == nir_texop_tex); in sample_plane()
251 assert(tex->coord_components == 2); in sample_plane()
254 nir_tex_instr_create(b->shader, tex->num_srcs + 1); in sample_plane()
255 for (unsigned i = 0; i < tex->num_srcs; i++) { in sample_plane()
256 nir_src_copy(&plane_tex->src[i].src, &tex->src[i].src, plane_tex); in sample_plane()
257 plane_tex->src[i].src_type = tex->src[i].src_type; in sample_plane()
259 plane_tex->src[tex->num_srcs].src = nir_src_for_ssa(nir_imm_int(b, plane)); in sample_plane()
260 plane_tex->src[tex->num_srcs].src_type = nir_tex_src_plane; in sample_plane()
266 plane_tex->texture_index = tex->texture_index; in sample_plane()
267 plane_tex->sampler_index = tex->sampler_index; in sample_plane()
270 nir_dest_bit_size(tex->dest), NULL); in sample_plane()
275 if (options->scale_factors[tex->texture_index]) in sample_plane()
277 options->scale_factors[tex->texture_index]); in sample_plane()
283 convert_yuv_to_rgb(nir_builder *b, nir_tex_instr *tex, in convert_yuv_to_rgb() argument
292 if (options->bt709_external & (1 << tex->texture_index)) { in convert_yuv_to_rgb()
295 } else if (options->bt2020_external & (1 << tex->texture_index)) { in convert_yuv_to_rgb()
308 unsigned bit_size = nir_dest_bit_size(tex->dest); in convert_yuv_to_rgb()
326 nir_ssa_def_rewrite_uses(&tex->dest.ssa, nir_src_for_ssa(result)); in convert_yuv_to_rgb()
330 lower_y_uv_external(nir_builder *b, nir_tex_instr *tex, in lower_y_uv_external() argument
333 b->cursor = nir_after_instr(&tex->instr); in lower_y_uv_external()
335 nir_ssa_def *y = sample_plane(b, tex, 0, options); in lower_y_uv_external()
336 nir_ssa_def *uv = sample_plane(b, tex, 1, options); in lower_y_uv_external()
338 convert_yuv_to_rgb(b, tex, in lower_y_uv_external()
347 lower_y_u_v_external(nir_builder *b, nir_tex_instr *tex, in lower_y_u_v_external() argument
350 b->cursor = nir_after_instr(&tex->instr); in lower_y_u_v_external()
352 nir_ssa_def *y = sample_plane(b, tex, 0, options); in lower_y_u_v_external()
353 nir_ssa_def *u = sample_plane(b, tex, 1, options); in lower_y_u_v_external()
354 nir_ssa_def *v = sample_plane(b, tex, 2, options); in lower_y_u_v_external()
356 convert_yuv_to_rgb(b, tex, in lower_y_u_v_external()
365 lower_yx_xuxv_external(nir_builder *b, nir_tex_instr *tex, in lower_yx_xuxv_external() argument
368 b->cursor = nir_after_instr(&tex->instr); in lower_yx_xuxv_external()
370 nir_ssa_def *y = sample_plane(b, tex, 0, options); in lower_yx_xuxv_external()
371 nir_ssa_def *xuxv = sample_plane(b, tex, 1, options); in lower_yx_xuxv_external()
373 convert_yuv_to_rgb(b, tex, in lower_yx_xuxv_external()
382 lower_xy_uxvx_external(nir_builder *b, nir_tex_instr *tex, in lower_xy_uxvx_external() argument
385 b->cursor = nir_after_instr(&tex->instr); in lower_xy_uxvx_external()
387 nir_ssa_def *y = sample_plane(b, tex, 0, options); in lower_xy_uxvx_external()
388 nir_ssa_def *uxvx = sample_plane(b, tex, 1, options); in lower_xy_uxvx_external()
390 convert_yuv_to_rgb(b, tex, in lower_xy_uxvx_external()
399 lower_ayuv_external(nir_builder *b, nir_tex_instr *tex, in lower_ayuv_external() argument
402 b->cursor = nir_after_instr(&tex->instr); in lower_ayuv_external()
404 nir_ssa_def *ayuv = sample_plane(b, tex, 0, options); in lower_ayuv_external()
406 convert_yuv_to_rgb(b, tex, in lower_ayuv_external()
415 lower_xyuv_external(nir_builder *b, nir_tex_instr *tex, in lower_xyuv_external() argument
418 b->cursor = nir_after_instr(&tex->instr); in lower_xyuv_external()
420 nir_ssa_def *xyuv = sample_plane(b, tex, 0, options); in lower_xyuv_external()
422 convert_yuv_to_rgb(b, tex, in lower_xyuv_external()
431 lower_yuv_external(nir_builder *b, nir_tex_instr *tex, in lower_yuv_external() argument
434 b->cursor = nir_after_instr(&tex->instr); in lower_yuv_external()
436 nir_ssa_def *yuv = sample_plane(b, tex, 0, options); in lower_yuv_external()
438 convert_yuv_to_rgb(b, tex, in lower_yuv_external()
451 replace_gradient_with_lod(nir_builder *b, nir_ssa_def *lod, nir_tex_instr *tex) in replace_gradient_with_lod() argument
453 assert(tex->op == nir_texop_txd); in replace_gradient_with_lod()
455 nir_tex_instr_remove_src(tex, nir_tex_instr_src_index(tex, nir_tex_src_ddx)); in replace_gradient_with_lod()
456 nir_tex_instr_remove_src(tex, nir_tex_instr_src_index(tex, nir_tex_src_ddy)); in replace_gradient_with_lod()
458 int min_lod_idx = nir_tex_instr_src_index(tex, nir_tex_src_min_lod); in replace_gradient_with_lod()
461 lod = nir_fmax(b, lod, nir_ssa_for_src(b, tex->src[min_lod_idx].src, 1)); in replace_gradient_with_lod()
462 nir_tex_instr_remove_src(tex, min_lod_idx); in replace_gradient_with_lod()
465 nir_tex_instr_add_src(tex, nir_tex_src_lod, nir_src_for_ssa(lod)); in replace_gradient_with_lod()
466 tex->op = nir_texop_txl; in replace_gradient_with_lod()
470 lower_gradient_cube_map(nir_builder *b, nir_tex_instr *tex) in lower_gradient_cube_map() argument
472 assert(tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE); in lower_gradient_cube_map()
473 assert(tex->op == nir_texop_txd); in lower_gradient_cube_map()
474 assert(tex->dest.is_ssa); in lower_gradient_cube_map()
477 nir_ssa_def *size = nir_i2f32(b, nir_get_texture_size(b, tex)); in lower_gradient_cube_map()
537 tex->src[nir_tex_instr_src_index(tex, nir_tex_src_coord)].src.ssa; in lower_gradient_cube_map()
541 tex->src[nir_tex_instr_src_index(tex, nir_tex_src_ddx)].src.ssa; in lower_gradient_cube_map()
543 tex->src[nir_tex_instr_src_index(tex, nir_tex_src_ddy)].src.ssa; in lower_gradient_cube_map()
613 replace_gradient_with_lod(b, lod, tex); in lower_gradient_cube_map()
617 lower_gradient(nir_builder *b, nir_tex_instr *tex) in lower_gradient() argument
620 if (tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE) { in lower_gradient()
621 lower_gradient_cube_map(b, tex); in lower_gradient()
625 assert(tex->sampler_dim != GLSL_SAMPLER_DIM_CUBE); in lower_gradient()
626 assert(tex->op == nir_texop_txd); in lower_gradient()
627 assert(tex->dest.is_ssa); in lower_gradient()
631 switch (tex->sampler_dim) { in lower_gradient()
644 nir_channels(b, nir_i2f32(b, nir_get_texture_size(b, tex)), in lower_gradient()
652 tex->src[nir_tex_instr_src_index(tex, nir_tex_src_ddx)].src.ssa; in lower_gradient()
654 tex->src[nir_tex_instr_src_index(tex, nir_tex_src_ddy)].src.ssa; in lower_gradient()
672 replace_gradient_with_lod(b, lod, tex); in lower_gradient()
676 saturate_src(nir_builder *b, nir_tex_instr *tex, unsigned sat_mask) in saturate_src() argument
678 b->cursor = nir_before_instr(&tex->instr); in saturate_src()
681 for (unsigned i = 0; i < tex->num_srcs; i++) { in saturate_src()
682 if (tex->src[i].src_type != nir_tex_src_coord) in saturate_src()
686 nir_ssa_for_src(b, tex->src[i].src, tex->coord_components); in saturate_src()
691 assume(tex->coord_components >= 1); in saturate_src()
693 for (unsigned j = 0; j < tex->coord_components; j++) in saturate_src()
697 unsigned ncomp = tex->coord_components; in saturate_src()
698 if (tex->is_array) in saturate_src()
703 if (tex->sampler_dim == GLSL_SAMPLER_DIM_RECT) { in saturate_src()
707 nir_ssa_def *txs = nir_i2f32(b, nir_get_texture_size(b, tex)); in saturate_src()
717 src = nir_vec(b, comp, tex->coord_components); in saturate_src()
719 nir_instr_rewrite_src(&tex->instr, in saturate_src()
720 &tex->src[i].src, in saturate_src()
746 swizzle_tg4_broadcom(nir_builder *b, nir_tex_instr *tex) in swizzle_tg4_broadcom() argument
748 assert(tex->dest.is_ssa); in swizzle_tg4_broadcom()
750 b->cursor = nir_after_instr(&tex->instr); in swizzle_tg4_broadcom()
752 assert(nir_tex_instr_dest_size(tex) == 4); in swizzle_tg4_broadcom()
754 nir_ssa_def *swizzled = nir_swizzle(b, &tex->dest.ssa, swiz, 4); in swizzle_tg4_broadcom()
756 nir_ssa_def_rewrite_uses_after(&tex->dest.ssa, nir_src_for_ssa(swizzled), in swizzle_tg4_broadcom()
761 swizzle_result(nir_builder *b, nir_tex_instr *tex, const uint8_t swizzle[4]) in swizzle_result() argument
763 assert(tex->dest.is_ssa); in swizzle_result()
765 b->cursor = nir_after_instr(&tex->instr); in swizzle_result()
768 if (tex->op == nir_texop_tg4) { in swizzle_result()
769 if (swizzle[tex->component] < 4) { in swizzle_result()
771 tex->component = swizzle[tex->component]; in swizzle_result()
774 swizzled = get_zero_or_one(b, tex->dest_type, swizzle[tex->component]); in swizzle_result()
777 assert(nir_tex_instr_dest_size(tex) == 4); in swizzle_result()
782 swizzled = nir_swizzle(b, &tex->dest.ssa, swiz, 4); in swizzle_result()
787 srcs[i] = nir_channel(b, &tex->dest.ssa, swizzle[i]); in swizzle_result()
789 srcs[i] = get_zero_or_one(b, tex->dest_type, swizzle[i]); in swizzle_result()
796 nir_ssa_def_rewrite_uses_after(&tex->dest.ssa, nir_src_for_ssa(swizzled), in swizzle_result()
801 linearize_srgb_result(nir_builder *b, nir_tex_instr *tex) in linearize_srgb_result() argument
803 assert(tex->dest.is_ssa); in linearize_srgb_result()
804 assert(nir_tex_instr_dest_size(tex) == 4); in linearize_srgb_result()
805 assert(nir_alu_type_get_base_type(tex->dest_type) == nir_type_float); in linearize_srgb_result()
807 b->cursor = nir_after_instr(&tex->instr); in linearize_srgb_result()
810 nir_format_srgb_to_linear(b, nir_channels(b, &tex->dest.ssa, 0x7)); in linearize_srgb_result()
817 nir_channel(b, &tex->dest.ssa, 3)); in linearize_srgb_result()
819 nir_ssa_def_rewrite_uses_after(&tex->dest.ssa, nir_src_for_ssa(result), in linearize_srgb_result()
833 lower_tex_packing(nir_builder *b, nir_tex_instr *tex, in lower_tex_packing() argument
836 nir_ssa_def *color = &tex->dest.ssa; in lower_tex_packing()
838 b->cursor = nir_after_instr(&tex->instr); in lower_tex_packing()
840 switch (options->lower_tex_packing[tex->sampler_index]) { in lower_tex_packing()
847 switch (nir_alu_type_get_base_type(tex->dest_type)) { in lower_tex_packing()
849 switch (nir_tex_instr_dest_size(tex)) { in lower_tex_packing()
851 assert(tex->is_shadow && tex->is_new_style_shadow); in lower_tex_packing()
891 assert(nir_alu_type_get_base_type(tex->dest_type) == nir_type_float); in lower_tex_packing()
896 nir_ssa_def_rewrite_uses_after(&tex->dest.ssa, nir_src_for_ssa(color), in lower_tex_packing()
901 sampler_index_lt(nir_tex_instr *tex, unsigned max) in sampler_index_lt() argument
903 assert(nir_tex_instr_src_index(tex, nir_tex_src_sampler_deref) == -1); in sampler_index_lt()
905 unsigned sampler_index = tex->sampler_index; in sampler_index_lt()
908 nir_tex_instr_src_index(tex, nir_tex_src_sampler_offset); in sampler_index_lt()
910 if (!nir_src_is_const(tex->src[sampler_offset_idx].src)) in sampler_index_lt()
913 sampler_index += nir_src_as_uint(tex->src[sampler_offset_idx].src); in sampler_index_lt()
920 lower_tg4_offsets(nir_builder *b, nir_tex_instr *tex) in lower_tg4_offsets() argument
922 assert(tex->op == nir_texop_tg4); in lower_tg4_offsets()
923 assert(nir_tex_instr_has_explicit_tg4_offsets(tex)); in lower_tg4_offsets()
924 assert(nir_tex_instr_src_index(tex, nir_tex_src_offset) == -1); in lower_tg4_offsets()
926 b->cursor = nir_after_instr(&tex->instr); in lower_tg4_offsets()
930 nir_tex_instr *tex_copy = nir_tex_instr_create(b->shader, tex->num_srcs + 1); in lower_tg4_offsets()
931 tex_copy->op = tex->op; in lower_tg4_offsets()
932 tex_copy->coord_components = tex->coord_components; in lower_tg4_offsets()
933 tex_copy->sampler_dim = tex->sampler_dim; in lower_tg4_offsets()
934 tex_copy->is_array = tex->is_array; in lower_tg4_offsets()
935 tex_copy->is_shadow = tex->is_shadow; in lower_tg4_offsets()
936 tex_copy->is_new_style_shadow = tex->is_new_style_shadow; in lower_tg4_offsets()
937 tex_copy->component = tex->component; in lower_tg4_offsets()
938 tex_copy->dest_type = tex->dest_type; in lower_tg4_offsets()
940 for (unsigned j = 0; j < tex->num_srcs; ++j) { in lower_tg4_offsets()
941 nir_src_copy(&tex_copy->src[j].src, &tex->src[j].src, tex_copy); in lower_tg4_offsets()
942 tex_copy->src[j].src_type = tex->src[j].src_type; in lower_tg4_offsets()
946 src.src = nir_src_for_ssa(nir_imm_ivec2(b, tex->tg4_offsets[i][0], in lower_tg4_offsets()
947 tex->tg4_offsets[i][1])); in lower_tg4_offsets()
952 nir_tex_instr_dest_size(tex), 32, NULL); in lower_tg4_offsets()
960 nir_ssa_def_rewrite_uses(&tex->dest.ssa, nir_src_for_ssa(res)); in lower_tg4_offsets()
961 nir_instr_remove(&tex->instr); in lower_tg4_offsets()
967 nir_lower_txs_lod(nir_builder *b, nir_tex_instr *tex) in nir_lower_txs_lod() argument
969 int lod_idx = nir_tex_instr_src_index(tex, nir_tex_src_lod); in nir_lower_txs_lod()
971 (nir_src_is_const(tex->src[lod_idx].src) && in nir_lower_txs_lod()
972 nir_src_as_int(tex->src[lod_idx].src) == 0)) in nir_lower_txs_lod()
975 unsigned dest_size = nir_tex_instr_dest_size(tex); in nir_lower_txs_lod()
977 b->cursor = nir_before_instr(&tex->instr); in nir_lower_txs_lod()
978 nir_ssa_def *lod = nir_ssa_for_src(b, tex->src[lod_idx].src, 1); in nir_lower_txs_lod()
981 nir_instr_rewrite_src(&tex->instr, &tex->src[lod_idx].src, in nir_lower_txs_lod()
985 b->cursor = nir_after_instr(&tex->instr); in nir_lower_txs_lod()
986 nir_ssa_def *minified = nir_imax(b, nir_ushr(b, &tex->dest.ssa, lod), in nir_lower_txs_lod()
992 if (tex->is_array) { in nir_lower_txs_lod()
999 comp[dest_size - 1] = nir_channel(b, &tex->dest.ssa, dest_size - 1); in nir_lower_txs_lod()
1003 nir_ssa_def_rewrite_uses_after(&tex->dest.ssa, nir_src_for_ssa(minified), in nir_lower_txs_lod()
1018 nir_tex_instr *tex = nir_instr_as_tex(instr); in nir_lower_tex_block() local
1019 bool lower_txp = !!(options->lower_txp & (1 << tex->sampler_dim)); in nir_lower_tex_block()
1024 if ((1 << tex->sampler_index) & options->saturate_r) in nir_lower_tex_block()
1026 if ((1 << tex->sampler_index) & options->saturate_t) in nir_lower_tex_block()
1028 if ((1 << tex->sampler_index) & options->saturate_s) in nir_lower_tex_block()
1035 progress |= project_src(b, tex); in nir_lower_tex_block()
1038 if ((tex->op == nir_texop_txf && options->lower_txf_offset) || in nir_lower_tex_block()
1039 (sat_mask && nir_tex_instr_src_index(tex, nir_tex_src_coord) >= 0) || in nir_lower_tex_block()
1040 (tex->sampler_dim == GLSL_SAMPLER_DIM_RECT && in nir_lower_tex_block()
1042 progress = lower_offset(b, tex) || progress; in nir_lower_tex_block()
1045 if ((tex->sampler_dim == GLSL_SAMPLER_DIM_RECT) && options->lower_rect && in nir_lower_tex_block()
1046 tex->op != nir_texop_txf && !nir_tex_instr_is_query(tex)) { in nir_lower_tex_block()
1047 lower_rect(b, tex); in nir_lower_tex_block()
1051 if ((1 << tex->texture_index) & options->lower_y_uv_external) { in nir_lower_tex_block()
1052 lower_y_uv_external(b, tex, options); in nir_lower_tex_block()
1056 if ((1 << tex->texture_index) & options->lower_y_u_v_external) { in nir_lower_tex_block()
1057 lower_y_u_v_external(b, tex, options); in nir_lower_tex_block()
1061 if ((1 << tex->texture_index) & options->lower_yx_xuxv_external) { in nir_lower_tex_block()
1062 lower_yx_xuxv_external(b, tex, options); in nir_lower_tex_block()
1066 if ((1 << tex->texture_index) & options->lower_xy_uxvx_external) { in nir_lower_tex_block()
1067 lower_xy_uxvx_external(b, tex, options); in nir_lower_tex_block()
1071 if ((1 << tex->texture_index) & options->lower_ayuv_external) { in nir_lower_tex_block()
1072 lower_ayuv_external(b, tex, options); in nir_lower_tex_block()
1076 if ((1 << tex->texture_index) & options->lower_xyuv_external) { in nir_lower_tex_block()
1077 lower_xyuv_external(b, tex, options); in nir_lower_tex_block()
1081 if ((1 << tex->texture_index) & options->lower_yuv_external) { in nir_lower_tex_block()
1082 lower_yuv_external(b, tex, options); in nir_lower_tex_block()
1087 saturate_src(b, tex, sat_mask); in nir_lower_tex_block()
1091 if (tex->op == nir_texop_tg4 && options->lower_tg4_broadcom_swizzle) { in nir_lower_tex_block()
1092 swizzle_tg4_broadcom(b, tex); in nir_lower_tex_block()
1096 if (((1 << tex->texture_index) & options->swizzle_result) && in nir_lower_tex_block()
1097 !nir_tex_instr_is_query(tex) && in nir_lower_tex_block()
1098 !(tex->is_shadow && tex->is_new_style_shadow)) { in nir_lower_tex_block()
1099 swizzle_result(b, tex, options->swizzles[tex->texture_index]); in nir_lower_tex_block()
1104 if (((1 << tex->texture_index) & options->lower_srgb) && in nir_lower_tex_block()
1105 !nir_tex_instr_is_query(tex) && !tex->is_shadow) { in nir_lower_tex_block()
1106 linearize_srgb_result(b, tex); in nir_lower_tex_block()
1111 nir_tex_instr_src_index(tex, nir_tex_src_min_lod) >= 0; in nir_lower_tex_block()
1113 nir_tex_instr_src_index(tex, nir_tex_src_offset) >= 0; in nir_lower_tex_block()
1115 if (tex->op == nir_texop_txb && tex->is_shadow && has_min_lod && in nir_lower_tex_block()
1117 lower_implicit_lod(b, tex); in nir_lower_tex_block()
1121 if (options->lower_tex_packing[tex->sampler_index] != in nir_lower_tex_block()
1123 tex->op != nir_texop_txs && in nir_lower_tex_block()
1124 tex->op != nir_texop_query_levels && in nir_lower_tex_block()
1125 tex->op != nir_texop_texture_samples) { in nir_lower_tex_block()
1126 lower_tex_packing(b, tex, options); in nir_lower_tex_block()
1130 if (tex->op == nir_texop_txd && in nir_lower_tex_block()
1132 (options->lower_txd_shadow && tex->is_shadow) || in nir_lower_tex_block()
1133 (options->lower_txd_shadow_clamp && tex->is_shadow && has_min_lod) || in nir_lower_tex_block()
1136 nir_tex_instr_src_index(tex, nir_tex_src_sampler_handle) != -1) || in nir_lower_tex_block()
1138 has_min_lod && !sampler_index_lt(tex, 16)) || in nir_lower_tex_block()
1140 tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE) || in nir_lower_tex_block()
1142 tex->sampler_dim == GLSL_SAMPLER_DIM_3D))) { in nir_lower_tex_block()
1143 lower_gradient(b, tex); in nir_lower_tex_block()
1156 if ((nir_tex_instr_src_index(tex, nir_tex_src_lod) == -1) && in nir_lower_tex_block()
1157 (tex->op == nir_texop_txf || tex->op == nir_texop_txs || in nir_lower_tex_block()
1158 tex->op == nir_texop_txl || tex->op == nir_texop_query_levels || in nir_lower_tex_block()
1159 (tex->op == nir_texop_tex && !shader_supports_implicit_lod))) { in nir_lower_tex_block()
1160 b->cursor = nir_before_instr(&tex->instr); in nir_lower_tex_block()
1161 nir_tex_instr_add_src(tex, nir_tex_src_lod, nir_src_for_ssa(nir_imm_int(b, 0))); in nir_lower_tex_block()
1162 if (tex->op == nir_texop_tex && options->lower_tex_without_implicit_lod) in nir_lower_tex_block()
1163 tex->op = nir_texop_txl; in nir_lower_tex_block()
1168 if (options->lower_txs_lod && tex->op == nir_texop_txs) { in nir_lower_tex_block()
1169 progress |= nir_lower_txs_lod(b, tex); in nir_lower_tex_block()
1176 if (tex->op == nir_texop_tg4 && in nir_lower_tex_block()
1177 nir_tex_instr_has_explicit_tg4_offsets(tex) && in nir_lower_tex_block()
1179 progress |= lower_tg4_offsets(b, tex); in nir_lower_tex_block()