radeonsi: fix mask checking when emitting scissors and viewports
authorMarek Olšák <marek.olsak@amd.com>
Thu, 7 Apr 2016 19:41:34 +0000 (21:41 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 12 Apr 2016 12:29:46 +0000 (14:29 +0200)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Grigori Goronzy <greg@chown.ath.cx>
src/gallium/drivers/radeonsi/si_state.c

index 6e406718d65f0eef759bc8b788639306a1a00769..0c46425be9b4a12050e9e7be088b5d23c5889cf4 100644 (file)
@@ -912,8 +912,10 @@ static void si_emit_scissors(struct si_context *sctx, struct r600_atom *atom)
        bool scissor_enable = sctx->queued.named.rasterizer->scissor_enable;
 
        /* The simple case: Only 1 viewport is active. */
-       if (mask & 1 &&
-           !si_get_vs_info(sctx)->writes_viewport_index) {
+       if (!si_get_vs_info(sctx)->writes_viewport_index) {
+               if (!(mask & 1))
+                       return;
+
                radeon_set_context_reg_seq(cs, R_028250_PA_SC_VPORT_SCISSOR_0_TL, 2);
                si_emit_one_scissor(cs, &sctx->viewports.states[0],
                                    scissor_enable ? &states[0] : NULL);
@@ -960,8 +962,10 @@ static void si_emit_viewports(struct si_context *sctx, struct r600_atom *atom)
        unsigned mask = sctx->viewports.dirty_mask;
 
        /* The simple case: Only 1 viewport is active. */
-       if (mask & 1 &&
-           !si_get_vs_info(sctx)->writes_viewport_index) {
+       if (!si_get_vs_info(sctx)->writes_viewport_index) {
+               if (!(mask & 1))
+                       return;
+
                radeon_set_context_reg_seq(cs, R_02843C_PA_CL_VPORT_XSCALE, 6);
                radeon_emit(cs, fui(states[0].scale[0]));
                radeon_emit(cs, fui(states[0].translate[0]));