radeonsi: only preload VertexID for the GS copy shader
authorMarek Olšák <marek.olsak@amd.com>
Sun, 22 Feb 2015 14:11:49 +0000 (15:11 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 24 Feb 2015 20:21:04 +0000 (21:21 +0100)
The copy shader doesn't use any other preloaded VGPRs.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/si_state_shaders.c

index 5b463365c967391ba5fcc04f3ed521f81a451a70..0a2ff2a2f03a4db1bd1ae51e4558522450aaa94a 100644 (file)
@@ -159,12 +159,14 @@ static void si_shader_vs(struct si_shader *shader)
        va = shader->bo->gpu_address;
        si_pm4_add_bo(pm4, shader->bo, RADEON_USAGE_READ, RADEON_PRIO_SHADER_DATA);
 
-       vgpr_comp_cnt = shader->uses_instanceid ? 3 : 0;
-
-       if (shader->is_gs_copy_shader)
+       if (shader->is_gs_copy_shader) {
+               vgpr_comp_cnt = 0; /* only VertexID is needed for GS-COPY. */
                num_user_sgprs = SI_GSCOPY_NUM_USER_SGPR;
-       else
+       } else if (shader->selector->type == PIPE_SHADER_VERTEX) {
+               vgpr_comp_cnt = shader->uses_instanceid ? 3 : 0;
                num_user_sgprs = SI_VS_NUM_USER_SGPR;
+       } else
+               assert(0);
 
        num_sgprs = shader->num_sgprs;
        if (num_user_sgprs > num_sgprs) {