ac/llvm,radeonsi: enable lower_array_layer_round_even
ACO need this to be done in nir. Remove the llvm round code because both radv and radeonsi do this in nir for both aco and llvm. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22573>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user