radeonsi: move current_rast_prim into si_context
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 26 Sep 2017 15:57:59 +0000 (17:57 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 2 Oct 2017 13:07:45 +0000 (15:07 +0200)
v2: rebase fixes

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeon/r600_pipe_common.c
src/gallium/drivers/radeon/r600_pipe_common.h
src/gallium/drivers/radeonsi/si_pipe.h
src/gallium/drivers/radeonsi/si_state_draw.c
src/gallium/drivers/radeonsi/si_state_shaders.c
src/gallium/drivers/radeonsi/si_state_viewport.c

index d50982b86361e593b65828edf117a3a55c91c919..1aceb5b75598a55f6c4f0f1f11b021b56a9b6ab9 100644 (file)
@@ -724,10 +724,6 @@ bool si_common_context_init(struct r600_common_context *rctx,
        rctx->dma_clear_buffer = r600_dma_clear_buffer_fallback;
        rctx->b.buffer_subdata = si_buffer_subdata;
 
-       /* Set a reasonable default to avoid a performance regression in r600
-        * on stable branches. */
-       rctx->current_rast_prim = PIPE_PRIM_TRIANGLES;
-
        if (rscreen->info.drm_major == 2 && rscreen->info.drm_minor >= 43) {
                rctx->b.get_device_reset_status = r600_get_reset_status;
                rctx->gpu_reset_counter =
index 1558943bfec96ddb347336b8695fd90986d97146..597ff0280e048cbb0de6eda42f5f9da2e194d02a 100644 (file)
@@ -571,7 +571,6 @@ struct r600_common_context {
 
        /* Additional context states. */
        unsigned flags; /* flush flags */
-       enum pipe_prim_type             current_rast_prim; /* primitive type after TES, GS */
 
        /* Queries. */
        /* Maintain the list of active queries for pausing between IBs. */
index b3d5b1864570177ba6bf9c88c2d80838531a8e76..e0759eddb2cb4bc9e6934c4279f74413d4e7c7c7 100644 (file)
@@ -433,6 +433,7 @@ struct si_context {
        unsigned                last_sc_line_stipple;
        unsigned                current_vs_state;
        unsigned                last_vs_state;
+       enum pipe_prim_type     current_rast_prim; /* primitive type after TES, GS */
 
        /* Scratch buffer */
        struct r600_atom        scratch_state;
index 9a6c9c8f8422eab2735cf79666695b318d27978c..2d4c9c5b9f3976380b71317ffd1dda47d9adeb55 100644 (file)
@@ -531,7 +531,7 @@ static unsigned si_get_ia_multi_vgt_param(struct si_context *sctx,
 static void si_emit_rasterizer_prim_state(struct si_context *sctx)
 {
        struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
-       enum pipe_prim_type rast_prim = sctx->b.current_rast_prim;
+       enum pipe_prim_type rast_prim = sctx->current_rast_prim;
        struct si_state_rasterizer *rs = sctx->emitted.named.rasterizer;
 
        /* Skip this if not rendering lines. */
@@ -581,7 +581,7 @@ static void si_emit_draw_registers(struct si_context *sctx,
 {
        struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
        unsigned prim = si_conv_pipe_prim(info->mode);
-       unsigned gs_out_prim = si_conv_prim_to_gs_out(sctx->b.current_rast_prim);
+       unsigned gs_out_prim = si_conv_prim_to_gs_out(sctx->current_rast_prim);
        unsigned ia_multi_vgt_param;
 
        ia_multi_vgt_param = si_get_ia_multi_vgt_param(sctx, info, num_patches);
@@ -1257,15 +1257,15 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
        } else
                rast_prim = info->mode;
 
-       if (rast_prim != sctx->b.current_rast_prim) {
-               bool old_is_poly = sctx->b.current_rast_prim >= PIPE_PRIM_TRIANGLES;
+       if (rast_prim != sctx->current_rast_prim) {
+               bool old_is_poly = sctx->current_rast_prim >= PIPE_PRIM_TRIANGLES;
                bool new_is_poly = rast_prim >= PIPE_PRIM_TRIANGLES;
                if (old_is_poly != new_is_poly) {
                        sctx->scissors.dirty_mask = (1 << SI_MAX_VIEWPORTS) - 1;
                        si_mark_atom_dirty(sctx, &sctx->scissors.atom);
                }
 
-               sctx->b.current_rast_prim = rast_prim;
+               sctx->current_rast_prim = rast_prim;
                sctx->do_update_shaders = true;
        }
 
index 42814d9fd5892ba5ec1349ceb822a984e11cdf3c..7619e2f04aa3395a1a9d65fd6419d70db365a714 100644 (file)
@@ -1408,10 +1408,10 @@ static inline void si_shader_selector_key(struct pipe_context *ctx,
                }
 
                if (rs) {
-                       bool is_poly = (sctx->b.current_rast_prim >= PIPE_PRIM_TRIANGLES &&
-                                       sctx->b.current_rast_prim <= PIPE_PRIM_POLYGON) ||
-                                      sctx->b.current_rast_prim >= PIPE_PRIM_TRIANGLES_ADJACENCY;
-                       bool is_line = !is_poly && sctx->b.current_rast_prim != PIPE_PRIM_POINTS;
+                       bool is_poly = (sctx->current_rast_prim >= PIPE_PRIM_TRIANGLES &&
+                                       sctx->current_rast_prim <= PIPE_PRIM_POLYGON) ||
+                                      sctx->current_rast_prim >= PIPE_PRIM_TRIANGLES_ADJACENCY;
+                       bool is_line = !is_poly && sctx->current_rast_prim != PIPE_PRIM_POINTS;
 
                        key->part.ps.prolog.color_two_side = rs->two_side && sel->info.colors_read;
                        key->part.ps.prolog.flatshade_colors = rs->flatshade && sel->info.colors_read;
index d462f7d0a28d8b69544eed9f9feac4c7755cfa94..eb4c00a24de8d02420b4c11f6b3d24805bcd765a 100644 (file)
@@ -186,7 +186,7 @@ static void si_emit_guardband(struct si_context *ctx,
        discard_x = 1.0;
        discard_y = 1.0;
 
-       if (ctx->b.current_rast_prim < PIPE_PRIM_TRIANGLES) {
+       if (ctx->current_rast_prim < PIPE_PRIM_TRIANGLES) {
                /* When rendering wide points or lines, we need to be more
                 * conservative about when to discard them entirely. Since
                 * point size can be determined by the VS output, we basically