From: Timothy Arceri Date: Fri, 19 Jan 2018 05:48:43 +0000 (+1100) Subject: ac: fix ac_build_varying_gather_values() for packed layouts X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5b9362c2482393888366db38cba04aaf042ba7a8;p=mesa.git ac: fix ac_build_varying_gather_values() for packed layouts This fixes a segfault for varyings not starting at component 0. Reviewed-by: Nicolai Hähnle --- 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, "");