r600/sfn: Make sure texture lowering is done in the right order

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18619>
This commit is contained in:
Gert Wollny 2022-09-16 14:55:20 +02:00 committed by Marge Bot
parent ed6204eb06
commit 1dca2b8ae9
2 changed files with 3 additions and 2 deletions

View file

@ -755,6 +755,7 @@ int r600_shader_from_nir(struct r600_context *rctx,
NIR_PASS_V(sh, nir_lower_alu_to_scalar, r600_lower_to_scalar_instr_filter, NULL);
NIR_PASS_V(sh, nir_lower_phis_to_scalar, false);
NIR_PASS_V(sh, nir_lower_alu_to_scalar, r600_lower_to_scalar_instr_filter, NULL);
NIR_PASS_V(sh, r600_nir_lower_int_tg4);
NIR_PASS_V(sh, r600::r600_nir_lower_tex_to_backend, rctx->b.gfx_level);
@ -787,7 +788,6 @@ int r600_shader_from_nir(struct r600_context *rctx,
while (optimize_once(sh));
NIR_PASS_V(sh, nir_lower_bool_to_int32);
NIR_PASS_V(sh, r600_nir_lower_int_tg4);
NIR_PASS_V(sh, nir_opt_algebraic_late);
if (sh->info.stage == MESA_SHADER_FRAGMENT)

View file

@ -87,7 +87,8 @@ r600_nir_lower_int_tg4_impl(nir_function_impl *impl)
if (instr->type == nir_instr_type_tex) {
nir_tex_instr *tex = nir_instr_as_tex(instr);
if (tex->op == nir_texop_tg4 &&
tex->sampler_dim != GLSL_SAMPLER_DIM_CUBE) {
tex->sampler_dim != GLSL_SAMPLER_DIM_CUBE &&
nir_tex_instr_src_index(tex, nir_tex_src_backend1) < 0) {
if (nir_alu_type_get_base_type(tex->dest_type) != nir_type_float) {
if (tex->sampler_dim != GLSL_SAMPLER_DIM_RECT)
lower_coord_shift_normalized(&b, tex);