radeonsi: save scissor state and sample mask for u_blitter
authorMarek Olšák <marek.olsak@amd.com>
Sun, 17 Aug 2014 14:25:01 +0000 (16:25 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 19 Aug 2014 10:20:18 +0000 (12:20 +0200)
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/si_blit.c
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/radeonsi/si_state.h

index bc31dfd55a830d830debc65de6e343daa864ea39..9a7a2fef690accbdc4a2dbd116a2814d7c965487 100644 (file)
@@ -59,9 +59,16 @@ static void si_blitter_begin(struct pipe_context *ctx, enum si_blitter_op op)
        util_blitter_save_geometry_shader(sctx->blitter, sctx->gs_shader);
        util_blitter_save_vertex_shader(sctx->blitter, sctx->vs_shader);
        util_blitter_save_vertex_elements(sctx->blitter, sctx->vertex_elements);
+       if (sctx->queued.named.sample_mask) {
+               util_blitter_save_sample_mask(sctx->blitter,
+                                             sctx->queued.named.sample_mask->sample_mask);
+       }
        if (sctx->queued.named.viewport) {
                util_blitter_save_viewport(sctx->blitter, &sctx->queued.named.viewport->viewport);
        }
+       if (sctx->queued.named.scissor) {
+               util_blitter_save_scissor(sctx->blitter, &sctx->queued.named.scissor->scissor);
+       }
        util_blitter_save_vertex_buffer_slot(sctx->blitter, sctx->vertex_buffer);
        util_blitter_save_so_targets(sctx->blitter, sctx->b.streamout.num_targets,
                                     (struct pipe_stream_output_target**)sctx->b.streamout.targets);
index 98c19d6ed34c5ca63409099406b723ac316e499c..fc928f3fc26b68b5a5874e25ae82fb6b7360b5c1 100644 (file)
@@ -458,18 +458,20 @@ static void si_set_scissor_states(struct pipe_context *ctx,
                                   const struct pipe_scissor_state *state)
 {
        struct si_context *sctx = (struct si_context *)ctx;
-       struct si_pm4_state *pm4 = si_pm4_alloc_state(sctx);
+       struct si_state_scissor *scissor = CALLOC_STRUCT(si_state_scissor);
+       struct si_pm4_state *pm4 = &scissor->pm4;
 
-       if (pm4 == NULL)
+       if (scissor == NULL)
                return;
 
+       scissor->scissor = *state;
        si_pm4_set_reg(pm4, R_028250_PA_SC_VPORT_SCISSOR_0_TL,
                       S_028250_TL_X(state->minx) | S_028250_TL_Y(state->miny) |
                       S_028250_WINDOW_OFFSET_DISABLE(1));
        si_pm4_set_reg(pm4, R_028254_PA_SC_VPORT_SCISSOR_0_BR,
                       S_028254_BR_X(state->maxx) | S_028254_BR_Y(state->maxy));
 
-       si_pm4_set_state(sctx, scissor, pm4);
+       si_pm4_set_state(sctx, scissor, scissor);
 }
 
 static void si_set_viewport_states(struct pipe_context *ctx,
@@ -2774,16 +2776,18 @@ static void si_bind_sampler_states(struct pipe_context *ctx, unsigned shader,
 static void si_set_sample_mask(struct pipe_context *ctx, unsigned sample_mask)
 {
        struct si_context *sctx = (struct si_context *)ctx;
-       struct si_pm4_state *pm4 = si_pm4_alloc_state(sctx);
+       struct si_state_sample_mask *state = CALLOC_STRUCT(si_state_sample_mask);
+       struct si_pm4_state *pm4 = &state->pm4;
        uint16_t mask = sample_mask;
 
-        if (pm4 == NULL)
+        if (state == NULL)
                 return;
 
+       state->sample_mask = mask;
        si_pm4_set_reg(pm4, R_028C38_PA_SC_AA_MASK_X0Y0_X1Y0, mask | (mask << 16));
        si_pm4_set_reg(pm4, R_028C3C_PA_SC_AA_MASK_X0Y1_X1Y1, mask | (mask << 16));
 
-       si_pm4_set_state(sctx, sample_mask, pm4);
+       si_pm4_set_state(sctx, sample_mask, state);
 }
 
 static void si_delete_sampler_state(struct pipe_context *ctx, void *state)
index 82bea790cff2f17a3c26881f756cf564b939a1be..ce18a27daed9a1072ffd6467351c66748dc3783f 100644 (file)
@@ -38,6 +38,16 @@ struct si_state_blend {
        bool                    alpha_to_one;
 };
 
+struct si_state_sample_mask {
+       struct si_pm4_state     pm4;
+       uint16_t                sample_mask;
+};
+
+struct si_state_scissor {
+       struct si_pm4_state             pm4;
+       struct pipe_scissor_state       scissor;
+};
+
 struct si_state_viewport {
        struct si_pm4_state             pm4;
        struct pipe_viewport_state      viewport;
@@ -82,8 +92,8 @@ union si_state {
                struct si_state_blend           *blend;
                struct si_pm4_state             *blend_color;
                struct si_pm4_state             *clip;
-               struct si_pm4_state             *sample_mask;
-               struct si_pm4_state             *scissor;
+               struct si_state_sample_mask     *sample_mask;
+               struct si_state_scissor         *scissor;
                struct si_state_viewport        *viewport;
                struct si_state_rasterizer      *rasterizer;
                struct si_state_dsa             *dsa;