radv/ac/llvm: shadow samplers only return one value.
authorDave Airlie <airlied@redhat.com>
Mon, 24 Oct 2016 21:47:13 +0000 (07:47 +1000)
committerDave Airlie <airlied@redhat.com>
Sun, 27 Nov 2016 23:05:01 +0000 (23:05 +0000)
The intrinsic engine asserts in llvm due to this.

Reported-by: Christoph Haag <haagch+mesadev@frickel.club>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_nir_to_llvm.c

index 76d6d887885352f11e8e902f194c262aa1515308..21089024e0073c51789195a7a1ca9ea58cb62697 100644 (file)
@@ -3627,7 +3627,9 @@ static void visit_tex(struct nir_to_llvm_context *ctx, nir_tex_instr *instr)
 
        result = build_tex_intrinsic(ctx, instr, &tinfo);
 
-       if (instr->op == nir_texop_query_levels)
+       if (instr->is_shadow)
+               result = LLVMBuildExtractElement(ctx->builder, result, ctx->i32zero, "");
+       else if (instr->op == nir_texop_query_levels)
                result = LLVMBuildExtractElement(ctx->builder, result, LLVMConstInt(ctx->i32, 3, false), "");
        else if (instr->op == nir_texop_txs &&
                 instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE &&