+/**
+ * Wraps the given region with a miptree.
+ */
+struct intel_mipmap_tree *
+intel_miptree_create_for_image_buffer(struct intel_context *intel,
+ enum __DRIimageBufferMask buffer_type,
+ mesa_format format,
+ uint32_t num_samples,
+ struct intel_region *region)
+{
+ struct intel_mipmap_tree *mt = NULL;
+
+ /* Only the front and back buffers, which are color buffers, are allocated
+ * through the image loader.
+ */
+ assert(_mesa_get_format_base_format(format) == GL_RGB ||
+ _mesa_get_format_base_format(format) == GL_RGBA);
+
+ mt = intel_miptree_create_for_bo(intel,
+ region->bo,
+ format,
+ 0,
+ region->width,
+ region->height,
+ region->pitch,
+ region->tiling);
+ return mt;
+}
+
+struct intel_mipmap_tree *