Mesa (master): radeonsi: Number of SGPRs retrieved from LLVM already includes VCC

Michel Dänzer daenzer at kemper.freedesktop.org
Tue Aug 6 11:10:42 UTC 2013


Module: Mesa
Branch: master
Commit: 46b6f79fea1042604ebb61a8214188fb807316ff
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=46b6f79fea1042604ebb61a8214188fb807316ff

Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue Aug  6 10:45:50 2013 +0200

radeonsi: Number of SGPRs retrieved from LLVM already includes VCC

Fixes spurious 'Assertion `num_sgprs <= 104' failed.' with shaders using
all 104 SGPRs.

Cc: mesa-stable at lists.freedesktop.org
Reviewed-by: Christian König <christian.koenig at amd.com>

---

 src/gallium/drivers/radeonsi/si_state_draw.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 29d960d..0d1bd81 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -91,10 +91,10 @@ static void si_pipe_shader_vs(struct pipe_context *ctx, struct si_pipe_shader *s
 
 	num_user_sgprs = SI_VS_NUM_USER_SGPR;
 	num_sgprs = shader->num_sgprs;
-	if (num_user_sgprs > num_sgprs)
-		num_sgprs = num_user_sgprs;
-	/* Last 2 reserved SGPRs are used for VCC */
-	num_sgprs += 2;
+	if (num_user_sgprs > num_sgprs) {
+		/* Last 2 reserved SGPRs are used for VCC */
+		num_sgprs = num_user_sgprs + 2;
+	}
 	assert(num_sgprs <= 104);
 
 	vgpr_comp_cnt = shader->shader.uses_instanceid ? 3 : 0;
@@ -235,10 +235,10 @@ static void si_pipe_shader_ps(struct pipe_context *ctx, struct si_pipe_shader *s
 
 	num_user_sgprs = SI_PS_NUM_USER_SGPR;
 	num_sgprs = shader->num_sgprs;
-	if (num_user_sgprs > num_sgprs)
-		num_sgprs = num_user_sgprs;
-	/* Last 2 reserved SGPRs are used for VCC */
-	num_sgprs += 2;
+	if (num_user_sgprs > num_sgprs) {
+		/* Last 2 reserved SGPRs are used for VCC */
+		num_sgprs = num_user_sgprs + 2;
+	}
 	assert(num_sgprs <= 104);
 
 	si_pm4_set_reg(pm4, R_00B028_SPI_SHADER_PGM_RSRC1_PS,




More information about the mesa-commit mailing list