From 5b9362c2482393888366db38cba04aaf042ba7a8 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Fri, 19 Jan 2018 16:48:43 +1100 Subject: [PATCH] ac: fix ac_build_varying_gather_values() for packed layouts MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This fixes a segfault for varyings not starting at component 0. Reviewed-by: Nicolai Hähnle --- src/amd/common/ac_llvm_build.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 3467bba693e..6615a269f83 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -413,7 +413,7 @@ ac_build_varying_gather_values(struct ac_llvm_context *ctx, LLVMValueRef *values for (unsigned i = component; i < value_count + component; i++) { LLVMValueRef value = values[i]; - if (!i) + if (i == component) vec = LLVMGetUndef( LLVMVectorType(LLVMTypeOf(value), value_count)); LLVMValueRef index = LLVMConstInt(ctx->i32, i - component, false); vec = LLVMBuildInsertElement(ctx->builder, vec, value, index, ""); -- 2.30.2