ac/nir: handle old-style shadow tex instructions correctly
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Sat, 24 Jun 2017 15:29:43 +0000 (17:29 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 31 Jul 2017 12:55:39 +0000 (14:55 +0200)
The first element is only extracted for new-style shadow tex.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/common/ac_nir_to_llvm.c

index d041e6a9dd5f24627a188473b25554913ec864e3..3125ade3b3f3b410e5ef6011b80c0ee828dea5db 100644 (file)
@@ -4624,7 +4624,9 @@ static void visit_tex(struct ac_nir_context *ctx, nir_tex_instr *instr)
 
        if (instr->op == nir_texop_query_levels)
                result = LLVMBuildExtractElement(ctx->ac.builder, result, LLVMConstInt(ctx->ac.i32, 3, false), "");
-       else if (instr->is_shadow && instr->op != nir_texop_txs && instr->op != nir_texop_lod && instr->op != nir_texop_tg4)
+       else if (instr->is_shadow && instr->is_new_style_shadow &&
+                instr->op != nir_texop_txs && instr->op != nir_texop_lod &&
+                instr->op != nir_texop_tg4)
                result = LLVMBuildExtractElement(ctx->ac.builder, result, ctx->ac.i32_0, "");
        else if (instr->op == nir_texop_txs &&
                 instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE &&