this->width = mt->level[level].width;
this->height = mt->level[level].height;
- /* Construct a dummy renderbuffer just to extract tile offsets. */
- struct intel_renderbuffer rb;
- rb.mt = mt;
- rb.mt_level = level;
- rb.mt_layer = layer;
- intel_renderbuffer_set_draw_offset(&rb);
- x_offset = rb.draw_x;
- y_offset = rb.draw_y;
+ intel_miptree_get_image_offset(mt, level, 0, layer, &x_offset, &y_offset);
}
void
this->brw_surfaceformat = BRW_SURFACEFORMAT_R8G8_UNORM;
break;
default:
- /* Blorp blits don't support any sort of format conversion, so we can
- * safely assume that the same format is being used for the source and
- * destination. Therefore the format must be supported as a render
- * target, even if this is the source image. So we can convert to a
- * surface format using brw->render_target_format.
+ /* Blorp blits don't support any sort of format conversion (except
+ * between sRGB and linear), so we can safely assume that the format is
+ * supported as a render target, even if this is the source image. So
+ * we can convert to a surface format using brw->render_target_format.
*/
assert(brw->format_supported_as_render_target[mt->format]);
this->brw_surfaceformat = brw->render_target_format[mt->format];
}
}
+
+/**
+ * Split x_offset and y_offset into a base offset (in bytes) and a remaining
+ * x/y offset (in pixels). Note: we can't do this by calling
+ * intel_renderbuffer_tile_offsets(), because the offsets may have been
+ * adjusted to account for Y vs. W tiling differences. So we compute it
+ * directly from the adjusted offsets.
+ */
+uint32_t
+brw_blorp_surface_info::compute_tile_offsets(uint32_t *tile_x,
+ uint32_t *tile_y) const
+{
+ struct intel_region *region = mt->region;
+ uint32_t mask_x, mask_y;
+
+ intel_region_get_tile_masks(region, &mask_x, &mask_y,
+ map_stencil_as_y_tiled);
+
+ *tile_x = x_offset & mask_x;
+ *tile_y = y_offset & mask_y;
+
+ return intel_region_get_aligned_offset(region, x_offset & ~mask_x,
+ y_offset & ~mask_y,
+ map_stencil_as_y_tiled);
+}
+
+
brw_blorp_params::brw_blorp_params()
: x0(0),
y0(0),