[Mesa-dev] [PATCH 4/5] i965: Add support for ARB_copy_image

Neil Roberts neil at linux.intel.com
Fri Aug 8 04:05:29 PDT 2014


Jason Ekstrand <jason at jlekstrand.net> writes:

> +   if (src_mt == dst_mt && src_level == dst_level && src_z == dst_z) {
> +      /* If we are on the same miptree, same level, and same slice, then
> +       * intel_miptree_map won't let us map it twice.  We have to do a
> +       * single map in read-write mode.
> +       */
> +
> +      map_x1 = MIN2(src_x, dst_x);
> +      map_y1 = MIN2(src_y, dst_y);
> +      map_x2 = MAX2(src_x, dst_x) + src_width;
> +      map_y2 = MAX2(src_y, dst_y) + src_height;
> +
> +      intel_miptree_map(brw, src_mt, src_level, src_z,
> +                        map_x1, map_y1, map_x2 - map_x1, map_y2 - map_y1,
> +                        GL_MAP_READ_BIT | GL_MAP_WRITE_BIT,
> +                        (void **)&mapped, &src_stride);
> +
> +      dst_stride = src_stride;
> +
> +      /* Set the offsets here so we don't have to think about it later */
> +      src_mapped = mapped + (src_y - map_y1) * src_stride +
> +                            (src_x - map_x1) * cpp;
> +      dst_mapped = mapped + (dst_y - map_y1) * dst_stride +
> +                            (dst_x - map_x1) * cpp;

This needs to take into account the block size of the format or it will
offset to the wrong position. I guess that is quite important as this
code path will only be used for compressed formats.

The commit message still mentions the maximum stride which is no longer
valid.

Regards,
- Neil


More information about the mesa-dev mailing list