From 68ebae30dfc895bfe769d0555a01681e40c8bbaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Wed, 12 Jul 2017 15:38:57 +0200 Subject: [PATCH] radeonsi/gfx9: fix crash building monolithic merged ES-GS shader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Forwarding from the ES prolog to the ES just barely exceeds the current maximum array size when 16 vertex attributes are used. Give it a decent bump to account for merged shaders having up to 32 user SGPRs. Fixes a crash in GL45-CTS.multi_bind.draw_bind_vertex_buffers. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Marek Olšák (cherry picked from commit c22e3c5373ad0df160f13fe8271c32e8d7e61b43) [Emil Velikov: resolve trivial conflicts - drop initial[] hunk] Signed-off-by: Emil Velikov Conflicts: src/gallium/drivers/radeonsi/si_shader.c --- src/gallium/drivers/radeonsi/si_shader.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index ff18272257a..bba97cce60c 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -7357,8 +7357,8 @@ static void si_build_wrapper_function(struct si_shader_context *ctx, struct gallivm_state *gallivm = &ctx->gallivm; LLVMBuilderRef builder = ctx->gallivm.builder; /* PS epilog has one arg per color component */ - LLVMTypeRef param_types[48]; - LLVMValueRef out[48]; + LLVMTypeRef param_types[64]; + LLVMValueRef out[64]; LLVMTypeRef function_type; unsigned num_params; unsigned num_out; @@ -7525,6 +7525,7 @@ static void si_build_wrapper_function(struct si_shader_context *ctx, LLVMValueRef val = LLVMBuildExtractValue(builder, ret, i, ""); + assert(num_out < ARRAY_SIZE(out)); out[num_out++] = val; if (LLVMTypeOf(val) == ctx->i32) {