r600g: Move geometry properties state from shader to selector
authorEdward O'Callaghan <eocallaghan@alterapraxis.com>
Sat, 29 Aug 2015 08:31:07 +0000 (18:31 +1000)
committerMarek Olšák <marek.olsak@amd.com>
Sun, 30 Aug 2015 09:40:44 +0000 (11:40 +0200)
Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_shader.c
src/gallium/drivers/r600/r600_shader.h
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/r600/r600_state_common.c

index 6a91d4709f4eecc00ca556aa10945cfd3ed20b2a..7c82390ba405e30bd11db002941cc957c7c95009 100644 (file)
@@ -2143,11 +2143,11 @@ static void evergreen_emit_shader_stages(struct r600_context *rctx, struct r600_
        if (state->geom_enable) {
                uint32_t cut_val;
 
-               if (rctx->gs_shader->current->shader.gs_max_out_vertices <= 128)
+               if (rctx->gs_shader->gs_max_out_vertices <= 128)
                        cut_val = V_028A40_GS_CUT_128;
-               else if (rctx->gs_shader->current->shader.gs_max_out_vertices <= 256)
+               else if (rctx->gs_shader->gs_max_out_vertices <= 256)
                        cut_val = V_028A40_GS_CUT_256;
-               else if (rctx->gs_shader->current->shader.gs_max_out_vertices <= 512)
+               else if (rctx->gs_shader->gs_max_out_vertices <= 512)
                        cut_val = V_028A40_GS_CUT_512;
                else
                        cut_val = V_028A40_GS_CUT_1024;
@@ -3013,7 +3013,7 @@ void evergreen_update_gs_state(struct pipe_context *ctx, struct r600_pipe_shader
        struct r600_shader *rshader = &shader->shader;
        struct r600_shader *cp_shader = &shader->gs_copy_shader->shader;
        unsigned gsvs_itemsize =
-                       (cp_shader->ring_item_size * rshader->gs_max_out_vertices) >> 2;
+                       (cp_shader->ring_item_size * shader->selector->gs_max_out_vertices) >> 2;
 
        r600_init_command_buffer(cb, 64);
 
@@ -3022,14 +3022,14 @@ void evergreen_update_gs_state(struct pipe_context *ctx, struct r600_pipe_shader
        r600_store_context_reg(cb, R_028AB8_VGT_VTX_CNT_EN, 1);
 
        r600_store_context_reg(cb, R_028B38_VGT_GS_MAX_VERT_OUT,
-                              S_028B38_MAX_VERT_OUT(rshader->gs_max_out_vertices));
+                              S_028B38_MAX_VERT_OUT(shader->selector->gs_max_out_vertices));
        r600_store_context_reg(cb, R_028A6C_VGT_GS_OUT_PRIM_TYPE,
-                              r600_conv_prim_to_gs_out(rshader->gs_output_prim));
+                              r600_conv_prim_to_gs_out(shader->selector->gs_output_prim));
 
        if (rctx->screen->b.info.drm_minor >= 35) {
                r600_store_context_reg(cb, R_028B90_VGT_GS_INSTANCE_CNT,
-                               S_028B90_CNT(MIN2(rshader->gs_num_invocations, 127)) |
-                               S_028B90_ENABLE(rshader->gs_num_invocations > 0));
+                               S_028B90_CNT(MIN2(shader->selector->gs_num_invocations, 127)) |
+                               S_028B90_ENABLE(shader->selector->gs_num_invocations > 0));
        }
        r600_store_context_reg_seq(cb, R_02891C_SQ_GS_VERT_ITEMSIZE, 4);
        r600_store_value(cb, cp_shader->ring_item_size >> 2);
index 3247aba969e13f1c82f748d70eb2e9d9fbc58051..eb7036048e54b268a56f94809f7d52af5818c8a3 100644 (file)
@@ -311,6 +311,11 @@ struct r600_pipe_shader_selector {
        /* PIPE_SHADER_[VERTEX|FRAGMENT|...] */
        unsigned        type;
 
+       /* geometry shader properties */
+       unsigned        gs_output_prim;
+       unsigned        gs_max_out_vertices;
+       unsigned        gs_num_invocations;
+
        unsigned        nr_ps_max_color_exports;
 };
 
index 44e41fb30a6737b8b6198004211d025a73fbd8a7..f0b794c809e013578019feef9e6f87ddafe0cb78 100644 (file)
@@ -2010,13 +2010,13 @@ static int r600_shader_from_tgsi(struct r600_context *rctx,
                                /* we don't need this one */
                                break;
                        case TGSI_PROPERTY_GS_OUTPUT_PRIM:
-                               shader->gs_output_prim = property->u[0].Data;
+                               pipeshader->selector->gs_output_prim = property->u[0].Data;
                                break;
                        case TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES:
-                               shader->gs_max_out_vertices = property->u[0].Data;
+                               pipeshader->selector->gs_max_out_vertices = property->u[0].Data;
                                break;
                        case TGSI_PROPERTY_GS_INVOCATIONS:
-                               shader->gs_num_invocations = property->u[0].Data;
+                               pipeshader->selector->gs_num_invocations = property->u[0].Data;
                                break;
                        }
                        break;
index 2b99b22a6b2dd4329c0c07738d0e6d720dd8f33c..f5ca9d67f1e249ab3020ebc9b250bd71a21583c1 100644 (file)
@@ -78,10 +78,6 @@ struct r600_shader {
        /* Temporarily workaround SB not handling CF_INDEX_[01] index registers */
        boolean                 uses_index_registers;
 
-       /* geometry shader properties */
-       unsigned                gs_output_prim;
-       unsigned                gs_max_out_vertices;
-       unsigned                gs_num_invocations;
        /* size in bytes of a data item in the ring (single vertex data) */
        unsigned                ring_item_size;
 
index 5cc2283792d852bb4b2b836199e6740409187a7e..51527631efd25ae1b6dbabb68f0b1611b58ba501 100644 (file)
@@ -1951,11 +1951,11 @@ static void r600_emit_shader_stages(struct r600_context *rctx, struct r600_atom
        if (state->geom_enable) {
                uint32_t cut_val;
 
-               if (rctx->gs_shader->current->shader.gs_max_out_vertices <= 128)
+               if (rctx->gs_shader->gs_max_out_vertices <= 128)
                        cut_val = V_028A40_GS_CUT_128;
-               else if (rctx->gs_shader->current->shader.gs_max_out_vertices <= 256)
+               else if (rctx->gs_shader->gs_max_out_vertices <= 256)
                        cut_val = V_028A40_GS_CUT_256;
-               else if (rctx->gs_shader->current->shader.gs_max_out_vertices <= 512)
+               else if (rctx->gs_shader->gs_max_out_vertices <= 512)
                        cut_val = V_028A40_GS_CUT_512;
                else
                        cut_val = V_028A40_GS_CUT_1024;
@@ -2650,7 +2650,7 @@ void r600_update_gs_state(struct pipe_context *ctx, struct r600_pipe_shader *sha
        struct r600_shader *rshader = &shader->shader;
        struct r600_shader *cp_shader = &shader->gs_copy_shader->shader;
        unsigned gsvs_itemsize =
-                       (cp_shader->ring_item_size * rshader->gs_max_out_vertices) >> 2;
+                       (cp_shader->ring_item_size * shader->selector->gs_max_out_vertices) >> 2;
 
        r600_init_command_buffer(cb, 64);
 
@@ -2659,10 +2659,10 @@ void r600_update_gs_state(struct pipe_context *ctx, struct r600_pipe_shader *sha
 
        if (rctx->b.chip_class >= R700) {
                r600_store_context_reg(cb, R_028B38_VGT_GS_MAX_VERT_OUT,
-                                      S_028B38_MAX_VERT_OUT(rshader->gs_max_out_vertices));
+                                      S_028B38_MAX_VERT_OUT(shader->selector->gs_max_out_vertices));
        }
        r600_store_context_reg(cb, R_028A6C_VGT_GS_OUT_PRIM_TYPE,
-                              r600_conv_prim_to_gs_out(rshader->gs_output_prim));
+                              r600_conv_prim_to_gs_out(shader->selector->gs_output_prim));
 
        r600_store_context_reg(cb, R_0288C8_SQ_GS_VERT_ITEMSIZE,
                               cp_shader->ring_item_size >> 2);
index a05dd8352c7e19f2a7da308b1e53cd1286697f70..63746b555026fee39f9fc8bd38380e1cf7cc4b78 100644 (file)
@@ -1524,7 +1524,7 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info
                unsigned prim = info.mode;
 
                if (rctx->gs_shader) {
-                       prim = rctx->gs_shader->current->shader.gs_output_prim;
+                       prim = rctx->gs_shader->gs_output_prim;
                }
                prim = r600_conv_prim_to_gs_out(prim); /* decrease the number of types to 3 */