i965/blorp: Increase Y alignment for multisampled stencil blits.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_blorp_blit.cpp
index 6e156d0f00af487bfbe046631e3513b8e64bd77c..034c7019573ef11304bc7ba9d9faadc9c4428a8d 100644 (file)
@@ -1800,6 +1800,11 @@ brw_blorp_blit_params::brw_blorp_blit_params(struct brw_context *brw,
        * account for the differences in aspect ratio between the Y and W
        * sub-tiles.  We need to modify the layer width and height similarly.
        *
+       * A correction needs to be applied when MSAA is in use: since
+       * INTEL_MSAA_LAYOUT_IMS uses an interleaving pattern whose height is 4,
+       * we need to align the Y coordinates to multiples of 8, so that when
+       * they are divided by two they are still multiples of 4.
+       *
        * Note: Since the x/y offset of the surface will be applied using the
        * SURFACE_STATE command packet, it will be invisible to the swizzling
        * code in the shader; therefore it needs to be in a multiple of the
@@ -1821,7 +1826,7 @@ brw_blorp_blit_params::brw_blorp_blit_params(struct brw_context *brw,
        * TODO: what if this makes the coordinates (or the texture size) too
        * large?
        */
-      const unsigned x_align = 8, y_align = 4;
+      const unsigned x_align = 8, y_align = dst.num_samples != 0 ? 8 : 4;
       x0 = ROUND_DOWN_TO(x0, x_align) * 2;
       y0 = ROUND_DOWN_TO(y0, y_align) / 2;
       x1 = ALIGN(x1, x_align) * 2;
@@ -1843,7 +1848,7 @@ brw_blorp_blit_params::brw_blorp_blit_params(struct brw_context *brw,
        *
        * TODO: what if this makes the texture size too large?
        */
-      const unsigned x_align = 8, y_align = 4;
+      const unsigned x_align = 8, y_align = src.num_samples != 0 ? 8 : 4;
       src.width = ALIGN(src.width, x_align) * 2;
       src.height = ALIGN(src.height, y_align) / 2;
       src.x_offset *= 2;