ac: fix ac_build_varying_gather_values() for packed layouts
authorTimothy Arceri <tarceri@itsqueeze.com>
Fri, 19 Jan 2018 05:48:43 +0000 (16:48 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Mon, 22 Jan 2018 23:00:52 +0000 (10:00 +1100)
This fixes a segfault for varyings not starting at component 0.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/amd/common/ac_llvm_build.c

index 3467bba693efb34bef17d2f3eedde9c41b8b42d7..6615a269f832e1bc02e91d29e672ca422a2a9734 100644 (file)
@@ -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, "");