r300g: only emit scissor when needed
[mesa.git] / src / gallium / drivers / r300 / r300_state.c
index 78764ddc98e74f8e6a6e91699cc01bfb7ce8f9cf..00f1b23117508dde764d76879aea7ee8c0a9511d 100644 (file)
@@ -474,36 +474,11 @@ static void r300_delete_dsa_state(struct pipe_context* pipe,
     FREE(state);
 }
 
-static void r300_set_scissor_regs(const struct pipe_scissor_state* state,
-                                  struct r300_scissor_regs *scissor,
-                                  boolean is_r500)
-{
-    if (is_r500) {
-        scissor->top_left =
-            (state->minx << R300_SCISSORS_X_SHIFT) |
-            (state->miny << R300_SCISSORS_Y_SHIFT);
-        scissor->bottom_right =
-            ((state->maxx - 1) << R300_SCISSORS_X_SHIFT) |
-            ((state->maxy - 1) << R300_SCISSORS_Y_SHIFT);
-    } else {
-        /* Offset of 1440 in non-R500 chipsets. */
-        scissor->top_left =
-            ((state->minx + 1440) << R300_SCISSORS_X_SHIFT) |
-            ((state->miny + 1440) << R300_SCISSORS_Y_SHIFT);
-        scissor->bottom_right =
-            (((state->maxx - 1) + 1440) << R300_SCISSORS_X_SHIFT) |
-            (((state->maxy - 1) + 1440) << R300_SCISSORS_Y_SHIFT);
-    }
-}
-
 static void
     r300_set_framebuffer_state(struct pipe_context* pipe,
                                const struct pipe_framebuffer_state* state)
 {
     struct r300_context* r300 = r300_context(pipe);
-    struct r300_scissor_state* scissor =
-        (struct r300_scissor_state*)r300->scissor_state.state;
-    struct pipe_scissor_state pscissor;
 
     if (r300->draw) {
         draw_flush(r300->draw);
@@ -511,13 +486,6 @@ static void
 
     r300->framebuffer_state = *state;
 
-    /* XXX Arg. This is silly. */
-    pscissor.minx = pscissor.miny = 0;
-    pscissor.maxx = state->width;
-    pscissor.maxy = state->height;
-    r300_set_scissor_regs(&pscissor, &scissor->framebuffer,
-                          r300_screen(r300->context.screen)->caps->is_r500);
-
     /* Don't rely on the order of states being set for the first time. */
     r300->dirty_state |= R300_NEW_FRAMEBUFFERS;
 
@@ -717,7 +685,11 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
         draw_set_rasterizer_state(r300->draw, &rs->rs);
     }
 
-    r300->tcl_bypass = rs->rs.bypass_vs_clip_and_viewport;
+    if (rs) {
+        r300->tcl_bypass = rs->rs.bypass_vs_clip_and_viewport;
+    } else {
+        r300->tcl_bypass = FALSE;
+    }
 
     r300->rs_state.state = rs;
     r300->rs_state.dirty = TRUE;
@@ -864,12 +836,9 @@ static void r300_set_scissor_state(struct pipe_context* pipe,
                                    const struct pipe_scissor_state* state)
 {
     struct r300_context* r300 = r300_context(pipe);
-    struct r300_scissor_state* scissor =
-        (struct r300_scissor_state*)r300->scissor_state.state;
-
-    r300_set_scissor_regs(state, &scissor->scissor,
-                          r300_screen(r300->context.screen)->caps->is_r500);
 
+    memcpy(r300->scissor_state.state, state,
+        sizeof(struct pipe_scissor_state));
     r300->scissor_state.dirty = TRUE;
 }