[Mesa-dev] [PATCH 3/3] st/mesa: implement ARB_copy_image
Marek Olšák
maraeo at gmail.com
Tue Nov 3 15:02:50 PST 2015
On Wed, Oct 28, 2015 at 5:25 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> On Sun, Oct 25, 2015 at 1:25 PM, Marek Olšák <maraeo at gmail.com> wrote:
>> +static void
>> +st_CopyImageSubData(struct gl_context *ctx,
>> + struct gl_texture_image *src_image,
>> + struct gl_renderbuffer *src_renderbuffer,
>> + int src_x, int src_y, int src_z,
>> + struct gl_texture_image *dst_image,
>> + struct gl_renderbuffer *dst_renderbuffer,
>> + int dst_x, int dst_y, int dst_z,
>> + int src_width, int src_height)
>> +{
>> + struct st_context *st = st_context(ctx);
>> + struct pipe_context *pipe = st->pipe;
>> + struct pipe_resource *src_res, *dst_res;
>> + struct pipe_box box;
>> + int src_level, dst_level;
>> +
>> + if (src_image) {
>> + struct st_texture_image *src = st_texture_image(src_image);
>> + src_res = src->pt;
>> + src_level = src_image->Level;
>> + src_z += src_image->Face;
>> + } else {
>> + struct st_renderbuffer *src = st_renderbuffer(src_renderbuffer);
>> + src_res = src->texture;
>> + src_level = 0;
>> + }
>> +
>> + if (dst_image) {
>> + struct st_texture_image *dst = st_texture_image(dst_image);
>> + dst_res = dst->pt;
>> + dst_level = dst_image->Level;
>> + dst_z += dst_image->Face;
>> + } else {
>> + struct st_renderbuffer *dst = st_renderbuffer(dst_renderbuffer);
>> + dst_res = dst->texture;
>> + dst_level = 0;
>> + }
>> +
>> + u_box_2d_zslice(src_x, src_y, src_z, src_width, src_height, &box);
>> +
>> + copy_image(pipe, dst_res, dst_level, dst_x, dst_y, dst_z,
>> + src_res, src_level, &box);
>> +}
>
> I know you've already pushed this, but the thought just occurred to me
> -- does this deal properly with texture views? I always get immensely
> confused by those, but shouldn't the levels/layers be offset by the
> texture object's minlayer/baselevel/minlevel somewhere? Possibly in
> _mesa_CopyImageSubData?
I don't know, maybe? Intel's intel_copy_image.c doesn't ignore
MinLevel, but ignores MinLayer. Meta ignores both. So does
main/copyimage.c when it checks region bounds.
Marek
More information about the mesa-dev
mailing list