amd/common: use ac_image_load when lod is zero
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 4 Jan 2018 15:24:22 +0000 (16:24 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 5 Jan 2018 08:49:45 +0000 (09:49 +0100)
This might decrease VGPR spilling, because we no longer
have to use v4i32 for 2D fetches when level == 0. We now
use v2i32 for those cases.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/common/ac_nir_to_llvm.c

index e9f997c7a45661aa6f1dfe1745630ac47a16fcf1..90faf0537f7280d5f210e74a83c9d35f832eeaaa 100644 (file)
@@ -2252,7 +2252,9 @@ static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx,
        case nir_texop_txf:
        case nir_texop_txf_ms:
        case nir_texop_samples_identical:
-               args->opcode = instr->sampler_dim == GLSL_SAMPLER_DIM_MS ? ac_image_load : ac_image_load_mip;
+               args->opcode = lod_is_zero ||
+                              instr->sampler_dim == GLSL_SAMPLER_DIM_MS ?
+                                       ac_image_load : ac_image_load_mip;
                args->compare = false;
                args->offset = false;
                break;