[Mesa-dev] [PATCH 2/2] radeonsi: Fix double compilation of shader variants.

Michel Dänzer michel at daenzer.net
Fri Sep 28 09:34:58 PDT 2012


From: Michel Dänzer <michel.daenzer at amd.com>

Fixes crash in piglit glsl-max-varyings.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/gallium/drivers/radeonsi/radeonsi_shader.c |    4 ++++
 src/gallium/drivers/radeonsi/si_state_draw.c   |    6 ------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index dbf2fa4..0712bcb 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -706,6 +706,10 @@ int si_pipe_shader_create(
 
 	dump = debug_get_bool_option("RADEON_DUMP_SHADERS", FALSE);
 
+	assert(shader->shader.noutput == 0);
+	assert(shader->shader.ninterp == 0);
+	assert(shader->shader.ninput == 0);
+
 	memset(&si_shader_ctx, 0, sizeof(si_shader_ctx));
 	radeon_llvm_context_init(&si_shader_ctx.radeon_bld);
 	bld_base = &si_shader_ctx.radeon_bld.soa.bld_base;
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index e6a2a58..a3d32a9 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -45,9 +45,6 @@ static void si_pipe_shader_vs(struct pipe_context *ctx, struct si_pipe_shader *s
 	unsigned nparams, i;
 	uint64_t va;
 
-	if (si_pipe_shader_create(ctx, shader))
-		return;
-
 	si_pm4_delete_state(rctx, vs, shader->pm4);
 	pm4 = shader->pm4 = CALLOC_STRUCT(si_pm4_state);
 
@@ -106,9 +103,6 @@ static void si_pipe_shader_ps(struct pipe_context *ctx, struct si_pipe_shader *s
 	unsigned spi_baryc_cntl, spi_ps_input_ena;
 	uint64_t va;
 
-	if (si_pipe_shader_create(ctx, shader))
-		return;
-
 	si_pm4_delete_state(rctx, ps, shader->pm4);
 	pm4 = shader->pm4 = CALLOC_STRUCT(si_pm4_state);
 
-- 
1.7.10.4



More information about the mesa-dev mailing list