diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 2a5d4b93960..c1b35435d63 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -4158,14 +4158,6 @@ static void tex_fetch_ptrs(struct ac_nir_context *ctx, nir_tex_instr *instr, } } -static LLVMValueRef apply_round_slice(struct ac_llvm_context *ctx, LLVMValueRef coord) -{ - coord = ac_to_float(ctx, coord); - coord = ac_build_round(ctx, coord); - coord = ac_to_integer(ctx, coord); - return coord; -} - static void visit_tex(struct ac_nir_context *ctx, nir_tex_instr *instr) { LLVMValueRef result = NULL; @@ -4323,22 +4315,6 @@ static void visit_tex(struct ac_nir_context *ctx, nir_tex_instr *instr) } /* Texture coordinates fixups */ - if (instr->coord_components > 1 && instr->sampler_dim == GLSL_SAMPLER_DIM_1D && - instr->is_array && instr->op != nir_texop_txf) { - if (!ctx->abi->conformant_trunc_coord) - args.coords[1] = apply_round_slice(&ctx->ac, args.coords[1]); - } - - if (instr->coord_components > 2 && - (instr->sampler_dim == GLSL_SAMPLER_DIM_2D || instr->sampler_dim == GLSL_SAMPLER_DIM_MS || - instr->sampler_dim == GLSL_SAMPLER_DIM_SUBPASS || - instr->sampler_dim == GLSL_SAMPLER_DIM_SUBPASS_MS) && - instr->is_array && instr->op != nir_texop_txf && instr->op != nir_texop_txf_ms && - instr->op != nir_texop_fragment_fetch_amd && instr->op != nir_texop_fragment_mask_fetch_amd) { - if (!ctx->abi->conformant_trunc_coord) - args.coords[2] = apply_round_slice(&ctx->ac, args.coords[2]); - } - if (ctx->ac.gfx_level == GFX9 && instr->sampler_dim == GLSL_SAMPLER_DIM_1D && instr->op != nir_texop_lod) { LLVMValueRef filler; diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 4fd29b0d2ba..7ffd9ef57e3 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -295,6 +295,7 @@ static void si_lower_nir(struct si_screen *sscreen, struct nir_shader *nir) .lower_invalid_implicit_lod = true, .lower_tg4_offsets = true, .lower_to_fragment_fetch_amd = sscreen->info.gfx_level < GFX11, + .lower_array_layer_round_even = !sscreen->info.conformant_trunc_coord, }; NIR_PASS_V(nir, nir_lower_tex, &lower_tex_options);