i965/vec4: Make with_writemask() non-static.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_blorp_clear.cpp
index 365c49c1eb1cfc704c306df1eb4fcd1d22b2548c..f26f39de0fcf687a3d61a88b34ac471a9bf2b1f7 100644 (file)
@@ -147,7 +147,6 @@ is_color_fast_clear_compatible(struct brw_context *brw,
                                gl_format format,
                                const union gl_color_union *color)
 {
-   struct intel_context *intel = &brw->intel;
    if (_mesa_is_format_integer_color(format))
       return false;
 
@@ -184,8 +183,7 @@ brw_blorp_clear_params::brw_blorp_clear_params(struct brw_context *brw,
                                                GLubyte *color_mask,
                                                bool partial_clear)
 {
-   struct intel_context *intel = &brw->intel;
-   struct gl_context *ctx = &intel->ctx;
+   struct gl_context *ctx = &brw->ctx;
    struct intel_renderbuffer *irb = intel_renderbuffer(rb);
 
    dst.set(brw, irb->mt, irb->mt_level, irb->mt_layer);
@@ -262,10 +260,25 @@ brw_blorp_clear_params::brw_blorp_clear_params(struct brw_context *brw,
       intel_get_non_msrt_mcs_alignment(brw, irb->mt, &x_align, &y_align);
       x_align *= 16;
       y_align *= 32;
-      x0 = ROUND_DOWN_TO(x0, x_align);
-      y0 = ROUND_DOWN_TO(y0, y_align);
-      x1 = ALIGN(x1, x_align);
-      y1 = ALIGN(y1, y_align);
+
+      if (brw->is_haswell && brw->gt == 3) {
+         /* From BSpec: 3D-Media-GPGPU Engine > 3D Pipeline > Pixel > Pixel
+          * Backend > MCS Buffer for Render Target(s) [DevIVB+]:
+          * [DevHSW:GT3]: Clear rectangle must be aligned to two times the
+          * number of pixels in the table shown below...
+          * x_align, y_align values computed above are the relevant entries
+          * in the referred table.
+          */
+         x0 = ROUND_DOWN_TO(x0, 2 * x_align);
+         y0 = ROUND_DOWN_TO(y0, 2 * y_align);
+         x1 = ALIGN(x1, 2 * x_align);
+         y1 = ALIGN(y1, 2 * y_align);
+      } else {
+         x0 = ROUND_DOWN_TO(x0,  x_align);
+         y0 = ROUND_DOWN_TO(y0, y_align);
+         x1 = ALIGN(x1, x_align);
+         y1 = ALIGN(y1, y_align);
+      }
 
       /* From the Ivy Bridge PRM, Vol2 Part1 11.7 "MCS Buffer for Render
        * Target(s)", beneath the "Fast Color Clear" bullet (p327):
@@ -329,7 +342,7 @@ brw_blorp_const_color_params::get_wm_prog(struct brw_context *brw,
                                           brw_blorp_prog_data **prog_data)
    const
 {
-   uint32_t prog_offset;
+   uint32_t prog_offset = 0;
    if (!brw_search_cache(&brw->cache, BRW_BLORP_CONST_COLOR_PROG,
                          &this->wm_prog_key, sizeof(this->wm_prog_key),
                          &prog_offset, prog_data)) {
@@ -429,7 +442,7 @@ bool
 brw_blorp_clear_color(struct brw_context *brw, struct gl_framebuffer *fb,
                       bool partial_clear)
 {
-   struct gl_context *ctx = &brw->intel.ctx;
+   struct gl_context *ctx = &brw->ctx;
 
    /* The constant color clear code doesn't work for multisampled surfaces, so
     * we need to support falling back to other clear mechanisms.