radeonsi: clean up small duplication in si_shader_gs
authorMarek Olšák <marek.olsak@amd.com>
Sun, 8 Nov 2015 10:49:33 +0000 (11:49 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 13 Nov 2015 18:54:42 +0000 (19:54 +0100)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_shader.h
src/gallium/drivers/radeonsi/si_state_shaders.c

index fd5500c1ab3d05a0ccca8cdffcad92051bb50ee5..bffffad9573806858f1f097f375523e6dd871ec2 100644 (file)
@@ -205,7 +205,8 @@ struct si_shader_selector {
        unsigned        gs_output_prim;
        unsigned        gs_max_out_vertices;
        unsigned        gs_num_invocations;
-       unsigned        gsvs_itemsize;
+       unsigned        gsvs_vertex_size;
+       unsigned        max_gsvs_emit_size;
 
        /* masks of "get_unique_index" bits */
        uint64_t        inputs_read;
index 93a689d9a07d57c99bd8dcecd5a36a5af01b4b5f..7a2cafeb9dc8af0150b3ee1bfcbd63d0b04515a3 100644 (file)
@@ -226,9 +226,9 @@ static unsigned si_gs_get_max_stream(struct si_shader *shader)
 
 static void si_shader_gs(struct si_shader *shader)
 {
-       unsigned gs_vert_itemsize = shader->selector->info.num_outputs * 16;
+       unsigned gs_vert_itemsize = shader->selector->gsvs_vertex_size;
        unsigned gs_max_vert_out = shader->selector->gs_max_out_vertices;
-       unsigned gsvs_itemsize = (gs_vert_itemsize * gs_max_vert_out) >> 2;
+       unsigned gsvs_itemsize = shader->selector->max_gsvs_emit_size >> 2;
        unsigned gs_num_invocations = shader->selector->gs_num_invocations;
        unsigned cut_mode;
        struct si_pm4_state *pm4;
@@ -713,8 +713,9 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
                        sel->info.properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES];
                sel->gs_num_invocations =
                        sel->info.properties[TGSI_PROPERTY_GS_INVOCATIONS];
-               sel->gsvs_itemsize = sel->info.num_outputs * 16 *
-                                    sel->gs_max_out_vertices;
+               sel->gsvs_vertex_size = sel->info.num_outputs * 16;
+               sel->max_gsvs_emit_size = sel->gsvs_vertex_size *
+                                         sel->gs_max_out_vertices;
 
                for (i = 0; i < sel->info.num_inputs; i++) {
                        unsigned name = sel->info.input_semantic_name[i];
@@ -1144,7 +1145,7 @@ static void si_init_gs_rings(struct si_context *sctx)
 
 static void si_update_gs_rings(struct si_context *sctx)
 {
-       unsigned gsvs_itemsize = sctx->gs_shader.cso->gsvs_itemsize;
+       unsigned gsvs_itemsize = sctx->gs_shader.cso->max_gsvs_emit_size;
        uint64_t offset;
 
        if (gsvs_itemsize == sctx->last_gsvs_itemsize)