summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2020-02-20 00:56:18 +0100
committerRoland Scheidegger <rscheidegger_lists@hispeed.ch>2020-02-20 17:32:54 +0000
commit7a73446c513e2218a08ae9425a1bea49c63080a7 (patch)
tree9d7c7b0c3b6f2d64d942295cdd3072175b8a067f
parent1b610aab583211210f189b46904b66c483f8e38b (diff)
downloadmesa-7a73446c513e2218a08ae9425a1bea49c63080a7.tar.gz
gallivm: fix crash in emit_get_buffer_size
Seems a bit odd we extract a value from a vector in the first place (as we always extract the first element), but llvm asserts if using a zero-vector instead of zero as the index element. Fixes piglit crashes for example in arb_shader_storage_buffer_object-layout-std140-write-shader. Reviewed-by: Brian Paul <brianp@vmware.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3886> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3886>
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
index a045e3712df..7e4f73f438e 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
@@ -1049,10 +1049,12 @@ static void emit_barrier(struct lp_build_nir_context *bld_base)
static LLVMValueRef emit_get_buffer_size(struct lp_build_nir_context *bld_base,
LLVMValueRef index)
{
+ struct gallivm_state *gallivm = bld_base->base.gallivm;
struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base;
LLVMBuilderRef builder = bld->bld_base.base.gallivm->builder;
struct lp_build_context *bld_broad = &bld_base->uint_bld;
- LLVMValueRef size_ptr = lp_build_array_get(bld_base->base.gallivm, bld->ssbo_sizes_ptr, LLVMBuildExtractElement(builder, index, bld_broad->zero, ""));
+ LLVMValueRef size_ptr = lp_build_array_get(bld_base->base.gallivm, bld->ssbo_sizes_ptr,
+ LLVMBuildExtractElement(builder, index, lp_build_const_int32(gallivm, 0), ""));
return lp_build_broadcast_scalar(bld_broad, size_ptr);
}