Mesa (master): ac: fix ac_build_varying_gather_values() for packed layouts

Timothy Arceri tarceri at kemper.freedesktop.org
Mon Jan 22 23:01:53 UTC 2018


Module: Mesa
Branch: master
Commit: 5b9362c2482393888366db38cba04aaf042ba7a8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b9362c2482393888366db38cba04aaf042ba7a8

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Fri Jan 19 16:48:43 2018 +1100

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 <nicolai.haehnle at amd.com>

---

 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 3467bba693..6615a269f8 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, "");




More information about the mesa-commit mailing list