summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2015-05-06 15:56:17 +0200
committerEmil Velikov <emil.l.velikov@gmail.com>2015-05-20 22:04:24 +0100
commit4504642cccdab7f276a7fa2a8f8af0f123a6b71b (patch)
tree869e94de6bdef8ba466962b01e518bf4dfdf7403
parentbe7b998a1f4d550634ba76320ba8d9ed033b50a4 (diff)
draw: (trivial) fix out-of-bounds vector initialization
Was off-by-one. llvm says inserting an element with an index higher than the number of elements yields undefined results. Previously such inserts were ignored but as of llvm revision 235854 the vector gets replaced with undef, causing failures. This fixes piglit gl-3.2-layered-rendering-gl-layer, as mentioned in https://llvm.org/bugs/show_bug.cgi?id=23424. Reviewed-by: Brian Paul <brianp@vmware.com> Cc: mesa-stable@lists.freedesktop.org (cherry picked from commit b8a1495106a8b70e9026b7798a5df2fb9737c55e)
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 6e1fb407c53..fca76a73eae 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -2049,7 +2049,7 @@ generate_mask_value(struct draw_gs_llvm_variant *variant,
num_prims = lp_build_broadcast(gallivm, lp_build_vec_type(gallivm, mask_type),
variant->num_prims);
- for (i = 0; i <= gs_type.length; i++) {
+ for (i = 0; i < gs_type.length; i++) {
LLVMValueRef idx = lp_build_const_int32(gallivm, i);
mask_val = LLVMBuildInsertElement(builder, mask_val, idx, idx, "");
}