diff options
author | Nicolai Hähnle <[email protected]> | 2017-09-13 10:47:02 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-09-18 11:25:18 +0200 |
commit | e0af3bed2cb52b5d8cf1da08b42cf28bae131c76 (patch) | |
tree | 5cd637e85621cc56e764eed5bb8566144c15259c | |
parent | 6fb0c1013b3578c5bd264efaa99a6d68418ccfb1 (diff) |
amd/common: round cube array slice in ac_prepare_cube_coords
The NIR-to-LLVM pass already does this; now the same fix covers
radeonsi as well.
Fixes various tests of
dEQP-GLES31.functional.texture.filtering.cube_array.combinations.*
Cc: [email protected]
Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 7 | ||||
-rw-r--r-- | src/amd/common/ac_llvm_build.h | 2 | ||||
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c | 1 |
4 files changed, 9 insertions, 5 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index a831baed3f5..7193b80be59 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -484,7 +484,7 @@ static void build_cube_select(LLVMBuilderRef builder, void ac_prepare_cube_coords(struct ac_llvm_context *ctx, - bool is_deriv, bool is_array, + bool is_deriv, bool is_array, bool is_lod, LLVMValueRef *coords_arg, LLVMValueRef *derivs_arg) { @@ -494,6 +494,11 @@ ac_prepare_cube_coords(struct ac_llvm_context *ctx, LLVMValueRef coords[3]; LLVMValueRef invma; + if (is_array && !is_lod) { + coords_arg[3] = ac_build_intrinsic(ctx, "llvm.rint.f32", ctx->f32, + &coords_arg[3], 1, 0); + } + build_cube_intrinsic(ctx, coords_arg, &selcoords); invma = ac_build_intrinsic(ctx, "llvm.fabs.f32", diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h index dae32e45752..14ec03f5c84 100644 --- a/src/amd/common/ac_llvm_build.h +++ b/src/amd/common/ac_llvm_build.h @@ -110,7 +110,7 @@ ac_build_fdiv(struct ac_llvm_context *ctx, void ac_prepare_cube_coords(struct ac_llvm_context *ctx, - bool is_deriv, bool is_array, + bool is_deriv, bool is_array, bool is_lod, LLVMValueRef *coords_arg, LLVMValueRef *derivs_arg); diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 42398d1230b..ba98cb2bde0 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -4550,15 +4550,13 @@ static void visit_tex(struct ac_nir_context *ctx, nir_tex_instr *instr) } if (instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE && coord) { - if (instr->is_array && instr->op != nir_texop_lod) - coords[3] = apply_round_slice(&ctx->ac, coords[3]); for (chan = 0; chan < instr->coord_components; chan++) coords[chan] = ac_to_float(&ctx->ac, coords[chan]); if (instr->coord_components == 3) coords[3] = LLVMGetUndef(ctx->ac.f32); ac_prepare_cube_coords(&ctx->ac, instr->op == nir_texop_txd, instr->is_array, - coords, derivs); + instr->op == nir_texop_lod, coords, derivs); if (num_deriv_comp) num_deriv_comp--; } diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c index a37fe586d6f..d0969a7dd02 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c @@ -1483,6 +1483,7 @@ static void tex_fetch_args( opcode == TGSI_OPCODE_TXD, target == TGSI_TEXTURE_CUBE_ARRAY || target == TGSI_TEXTURE_SHADOWCUBE_ARRAY, + opcode == TGSI_OPCODE_LODQ, coords, derivs); if (opcode == TGSI_OPCODE_TXD) |