Mesa (master): i965/msaa: use ROUND_DOWN_TO macro.

Paul Berry stereotype441 at kemper.freedesktop.org
Thu Jul 26 22:04:36 UTC 2012


Module: Mesa
Branch: master
Commit: 4df2848786d4778a2ce7dbf2e046e191036ccb56
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4df2848786d4778a2ce7dbf2e046e191036ccb56

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Tue Jul 24 14:48:51 2012 -0700

i965/msaa: use ROUND_DOWN_TO macro.

No functional change.  This patch modifies brw_blorp_blit.cpp to use
the ROUND_DOWN_TO macro instead of open-coded bit manipulations, for
clarity.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_blorp_blit.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index bd15632..296b99f 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -1733,14 +1733,14 @@ brw_blorp_blit_params::brw_blorp_blit_params(struct brw_context *brw,
       assert(dst_mt->msaa_layout == INTEL_MSAA_LAYOUT_IMS);
       switch (dst_mt->num_samples) {
       case 4:
-         x0 = (x0 * 2) & ~3;
-         y0 = (y0 * 2) & ~3;
+         x0 = ROUND_DOWN_TO(x0 * 2, 4);
+         y0 = ROUND_DOWN_TO(y0 * 2, 4);
          x1 = ALIGN(x1 * 2, 4);
          y1 = ALIGN(y1 * 2, 4);
          break;
       case 8:
-         x0 = (x0 * 4) & ~7;
-         y0 = (y0 * 2) & ~3;
+         x0 = ROUND_DOWN_TO(x0 * 4, 8);
+         y0 = ROUND_DOWN_TO(y0 * 2, 4);
          x1 = ALIGN(x1 * 4, 8);
          y1 = ALIGN(y1 * 2, 4);
          break;
@@ -1770,8 +1770,8 @@ brw_blorp_blit_params::brw_blorp_blit_params(struct brw_context *brw,
          x_align /= (dst_mt->num_samples == 4 ? 2 : 4);
          y_align /= 2;
       }
-      x0 = (x0 & ~(x_align - 1)) * 2;
-      y0 = (y0 & ~(y_align - 1)) / 2;
+      x0 = ROUND_DOWN_TO(x0, x_align) * 2;
+      y0 = ROUND_DOWN_TO(y0, y_align) / 2;
       x1 = ALIGN(x1, x_align) * 2;
       y1 = ALIGN(y1, y_align) / 2;
       wm_prog_key.use_kill = true;




More information about the mesa-commit mailing list