From: Dave Airlie Date: Mon, 24 Oct 2016 20:53:03 +0000 (+1000) Subject: radv/ac/llvm: trim texture return values X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d548fa882b865b8e5052954b872e392312c38ab8;p=mesa.git radv/ac/llvm: trim texture return values The intrinsic engine asserts in llvm due to this, as we put a vec4 into a vec1, and the next instruction isn't expecting it. So trim the vector at the end before inserting it. Reported-by: Christoph Haag Reviewed-by: Bas Nieuwenhuizen Cc: "13.0" Signed-off-by: Dave Airlie --- diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index b602c5e61c5..c12c506a892 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -3520,7 +3520,8 @@ static void visit_tex(struct nir_to_llvm_context *ctx, nir_tex_instr *instr) LLVMValueRef z = LLVMBuildExtractElement(ctx->builder, result, two, ""); z = LLVMBuildSDiv(ctx->builder, z, six, ""); result = LLVMBuildInsertElement(ctx->builder, result, z, two, ""); - } + } else if (instr->dest.ssa.num_components != 4) + result = trim_vector(ctx, result, instr->dest.ssa.num_components); write_result: if (result) {