diff --git a/src/gallium/drivers/r600/sfn/sfn_nir.cpp b/src/gallium/drivers/r600/sfn/sfn_nir.cpp index fc09aedc207..2f0982314e6 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir.cpp @@ -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) diff --git a/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp b/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp index 71fc41c43e9..26b8bb84bf1 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp @@ -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);