r300g: Correct scissor setting, subtract 1 from window's width and height
authorCooper Yuan <cooperyuan@gmail.com>
Thu, 27 Aug 2009 09:46:59 +0000 (17:46 +0800)
committerCooper Yuan <cooperyuan@gmail.com>
Thu, 27 Aug 2009 09:46:59 +0000 (17:46 +0800)
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_surface.c

index 27680a38631bcfd8c2fffe4d25a09d07145ae9e1..c16cadd04079b778adce3448a6888e99c59dc9e2 100644 (file)
@@ -538,16 +538,16 @@ static void r300_set_scissor_state(struct pipe_context* pipe,
             (state->minx << R300_SCISSORS_X_SHIFT) |
             (state->miny << R300_SCISSORS_Y_SHIFT);
         r300->scissor_state->scissor_bottom_right =
-            (state->maxx << R300_SCISSORS_X_SHIFT) |
-            (state->maxy << R300_SCISSORS_Y_SHIFT);
+            ((state->maxx - 1) << R300_SCISSORS_X_SHIFT) |
+            ((state->maxy - 1) << R300_SCISSORS_Y_SHIFT);
     } else {
         /* Offset of 1440 in non-R500 chipsets. */
         r300->scissor_state->scissor_top_left =
             ((state->minx + 1440) << R300_SCISSORS_X_SHIFT) |
             ((state->miny + 1440) << R300_SCISSORS_Y_SHIFT);
         r300->scissor_state->scissor_bottom_right =
-            ((state->maxx + 1440) << R300_SCISSORS_X_SHIFT) |
-            ((state->maxy + 1440) << R300_SCISSORS_Y_SHIFT);
+            (((state->maxx - 1) + 1440) << R300_SCISSORS_X_SHIFT) |
+            (((state->maxy - 1) + 1440) << R300_SCISSORS_Y_SHIFT);
     }
 
     r300->dirty_state |= R300_NEW_SCISSOR;
index a093f83945412a80a49ec04bf75b92fd4f36f3df..96e6e4a77d49bbb44b070983eb16eede6d7f7fd2 100644 (file)
@@ -58,13 +58,13 @@ static void r300_surface_setup(struct r300_context* r300,
     OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2);
     if (caps->is_r500) {
         OUT_CS((x << R300_SCISSORS_X_SHIFT) | (y << R300_SCISSORS_Y_SHIFT));
-        OUT_CS((w << R300_SCISSORS_X_SHIFT) | (h << R300_SCISSORS_Y_SHIFT));
+        OUT_CS(((w - 1) << R300_SCISSORS_X_SHIFT) | ((h - 1) << R300_SCISSORS_Y_SHIFT));
     } else {
         /* Non-R500 chipsets have an offset of 1440 in their scissors. */
         OUT_CS(((x + 1440) << R300_SCISSORS_X_SHIFT) |
                 ((y + 1440) << R300_SCISSORS_Y_SHIFT));
-        OUT_CS(((w + 1440) << R300_SCISSORS_X_SHIFT) |
-                ((h + 1440) << R300_SCISSORS_Y_SHIFT));
+        OUT_CS((((w - 1) + 1440) << R300_SCISSORS_X_SHIFT) |
+                (((h - 1) + 1440) << R300_SCISSORS_Y_SHIFT));
     }
 
     /* Flush colorbuffer and blend caches. */