Mesa (master): radeonsi/gfx9: fix crash building monolithic merged ES-GS shader
Nicolai Hähnle
nh at kemper.freedesktop.org
Thu Jul 13 11:01:40 UTC 2017
Module: Mesa
Branch: master
Commit: c22e3c5373ad0df160f13fe8271c32e8d7e61b43
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c22e3c5373ad0df160f13fe8271c32e8d7e61b43
Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date: Wed Jul 12 15:38:57 2017 +0200
radeonsi/gfx9: fix crash building monolithic merged ES-GS shader
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 at lists.freedesktop.org
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/drivers/radeonsi/si_shader.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 349e57b3a9..4c0cda58fb 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5892,9 +5892,11 @@ 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 initial[48], out[48];
+ /* PS epilog has one arg per color component; gfx9 merged shader
+ * prologs need to forward 32 user SGPRs.
+ */
+ LLVMTypeRef param_types[64];
+ LLVMValueRef initial[64], out[64];
LLVMTypeRef function_type;
unsigned num_params;
unsigned num_out, initial_num_out;
@@ -6114,6 +6116,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) {
More information about the mesa-commit
mailing list