radeonsi: Number of SGPRs retrieved from LLVM already includes VCC
authorMichel Dänzer <michel.daenzer@amd.com>
Tue, 6 Aug 2013 08:45:50 +0000 (10:45 +0200)
committerMichel Dänzer <michel@daenzer.net>
Tue, 6 Aug 2013 10:50:01 +0000 (12:50 +0200)
Fixes spurious 'Assertion `num_sgprs <= 104' failed.' with shaders using
all 104 SGPRs.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/drivers/radeonsi/si_state_draw.c

index 29d960d24034e6866036fbe5f12aa5a74a5a668c..0d1bd818e4612ddea02f3eafb10f2471cc085feb 100644 (file)
@@ -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,