[Mesa-dev] [PATCH 2/4] common: Correct PBO 2D_ARRAY handling.

Laura Ekstrand laura at jlekstrand.net
Tue Feb 24 13:39:26 PST 2015


Jason and I did some more looking today.  The current implementation of
create_texture_for_pbo checks for  *PACK_IMAGE_HEIGHT != height and returns
NULL.  Therefore, only tightly packed image arrays enter the meta pbo path,
and there is no pbo packing bug with the patch above as it stands.

On Mon, Feb 23, 2015 at 11:33 AM, Neil Roberts <neil at linux.intel.com> wrote:

> This looks like a good idea to me. I now wonder if we should go further
> and remove the depth parameter from create_texture_for_pbo, revert
> 404660e3c7bc6 and document that SetTextureStorageForBufferObject doesn't
> work for array textures.
>
> I originally reviewed 404660e3 but now I understand the miptree layout
> code a bit better and I don't think it will work anyway. The layouting
> code has to insert some padding between array images to make it match
> various constraints that depend on the hardware generation. It is
> unlikely that these constraints will happen to match whatever layout is
> in the buffer object so I don't think it's really practical to make an
> array texture out of it.
>
> Seeing as we're doing a blit for each slice of the texture anyway we
> don't need to create an array texture as the source. That way it is easy
> to make it also cope with the image stride unpacking option.
>
> Regards,
> - Neil
>
> Laura Ekstrand <laura at jlekstrand.net> writes:
>
> > Changes PBO uploads and downloads to use a tall (height * depth) 2D
> texture
> > for blitting.  This fixes the bug where 2D_ARRAY, 3D, and CUBE_MAP_ARRAY
> > textures are not properly uploaded and downloaded.
> > ---
> >  src/mesa/drivers/common/meta_tex_subimage.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/mesa/drivers/common/meta_tex_subimage.c
> b/src/mesa/drivers/common/meta_tex_subimage.c
> > index f4f7716..ee3295b 100644
> > --- a/src/mesa/drivers/common/meta_tex_subimage.c
> > +++ b/src/mesa/drivers/common/meta_tex_subimage.c
> > @@ -110,7 +110,7 @@ create_texture_for_pbo(struct gl_context *ctx, bool
> create_pbo,
> >     internal_format = _mesa_get_format_base_format(pbo_format);
> >
> >     tex_image = _mesa_get_tex_image(ctx, tex_obj, tex_obj->Target, 0);
> > -   _mesa_init_teximage_fields(ctx, tex_image, width, height, depth,
> > +   _mesa_init_teximage_fields(ctx, tex_image, width, height * depth, 1,
> >                                0, internal_format, pbo_format);
> >
> >     read_only = pbo_target == GL_PIXEL_UNPACK_BUFFER;
> > @@ -227,7 +227,7 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx,
> GLuint dims,
> >        _mesa_update_state(ctx);
> >
> >        _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
> > -                                 0, 0, width, height,
> > +                                 0, z * height, width, (z + 1) * height,
> >                                   xoffset, yoffset,
> >                                   xoffset + width, yoffset + height,
> >                                   GL_COLOR_BUFFER_BIT, GL_NEAREST);
> > @@ -349,7 +349,7 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context
> *ctx, GLuint dims,
> >        _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
> >                                   xoffset, yoffset,
> >                                   xoffset + width, yoffset + height,
> > -                                 0, 0, width, height,
> > +                                 0, z * height, width, (z + 1) * height,
> >                                   GL_COLOR_BUFFER_BIT, GL_NEAREST);
> >     }
> >
> > --
> > 2.1.0
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150224/a2889ce1/attachment-0001.html>


More information about the mesa-dev mailing list