summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_llvm.c
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-05-14 03:47:36 -0400
committerZack Rusin <[email protected]>2013-05-14 04:04:08 -0400
commit013424678e2604a45c420ec403e6f12b82446b24 (patch)
tree6aab01d2abe0bdc49ebeb6e0fcc3c792147aba2f /src/gallium/auxiliary/draw/draw_llvm.c
parenta6961f391ae9589a814b46c104d9163021c9f397 (diff)
draw/gs: fix extracting of the clip
The indices are not consecutive when using the geometry shader, which means we were extracting non existing values. Create an array of linear indices and always use it instead of the passed indices. Found by Jose. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_llvm.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 017d7294100..4a71955f56a 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -871,6 +871,7 @@ store_aos_array(struct gallivm_state *gallivm,
LLVMBuilderRef builder = gallivm->builder;
LLVMValueRef attr_index = lp_build_const_int32(gallivm, attrib);
LLVMValueRef inds[LP_MAX_VECTOR_WIDTH / 32];
+ LLVMValueRef linear_inds[LP_MAX_VECTOR_WIDTH / 32];
LLVMValueRef io_ptrs[LP_MAX_VECTOR_WIDTH / 32];
int vector_length = soa_type.length;
int i;
@@ -878,10 +879,11 @@ store_aos_array(struct gallivm_state *gallivm,
debug_assert(TGSI_NUM_CHANNELS == 4);
for (i = 0; i < vector_length; i++) {
+ linear_inds[i] = lp_build_const_int32(gallivm, i);
if (indices) {
inds[i] = indices[i];
} else {
- inds[i] = lp_build_const_int32(gallivm, i);
+ inds[i] = linear_inds[i];
}
io_ptrs[i] = LLVMBuildGEP(builder, io_ptr, &inds[i], 1, "");
}
@@ -904,7 +906,7 @@ store_aos_array(struct gallivm_state *gallivm,
cliptmp = LLVMBuildOr(builder, val, clipmask, "");
for (i = 0; i < vector_length; i++) {
LLVMValueRef id_ptr = draw_jit_header_id(gallivm, io_ptrs[i]);
- val = LLVMBuildExtractElement(builder, cliptmp, inds[i], "");
+ val = LLVMBuildExtractElement(builder, cliptmp, linear_inds[i], "");
val = adjust_mask(gallivm, val);
LLVMBuildStore(builder, val, id_ptr);
#if DEBUG_STORE