aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-04-26 22:53:07 -0400
committerZack Rusin <[email protected]>2013-04-27 01:18:51 -0400
commitf9f57312de863dd058a595c69ef3f42a5d90bce5 (patch)
treec33d8e4b341337aed8ab813c8fba3fe84f544082 /src/gallium
parent3093ac6f4fe8a4e57bcc0e82adef98806ec1e0d4 (diff)
gallivm: fix indirect addressing of temps in soa mode
we weren't adding the soa offsets when constructing the indices for the gather functions. That meant that we were always returning the data in the first vertex/primitive/pixel in the SoA structure and not correctly fetching from all structures. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index b3e39150f86..733f0ed1cae 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -1110,6 +1110,7 @@ emit_fetch_temporary(
struct gallivm_state *gallivm = bld->bld_base.base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
struct lp_build_context *uint_bld = &bld_base->uint_bld;
+ struct lp_build_context *float_bld = &bld_base->base;
LLVMValueRef indirect_index = NULL;
LLVMValueRef res;
@@ -1128,12 +1129,22 @@ emit_fetch_temporary(
bld->bld_base.base.type.length);
LLVMValueRef index_vec; /* index into the const buffer */
LLVMValueRef temps_array;
+ LLVMValueRef pixel_offsets;
+ LLVMValueRef offsets[LP_MAX_VECTOR_LENGTH];
LLVMTypeRef float4_ptr_type;
+ int i;
+
+ /* build pixel offset vector: {0, 1, 2, 3, ...} */
+ for (i = 0; i < float_bld->type.length; i++) {
+ offsets[i] = lp_build_const_int32(gallivm, i);
+ }
+ pixel_offsets = LLVMConstVector(offsets, float_bld->type.length);
/* index_vec = (indirect_index * 4 + swizzle) * length */
index_vec = lp_build_shl_imm(uint_bld, indirect_index, 2);
index_vec = lp_build_add(uint_bld, index_vec, swizzle_vec);
index_vec = lp_build_mul(uint_bld, index_vec, length_vec);
+ index_vec = lp_build_add(uint_bld, index_vec, pixel_offsets);
/* cast temps_array pointer to float* */
float4_ptr_type = LLVMPointerType(LLVMFloatTypeInContext(bld->bld_base.base.gallivm->context), 0);