<div dir="ltr"><div>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.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 23, 2015 at 11:33 AM, Neil Roberts <span dir="ltr"><<a href="mailto:neil@linux.intel.com" target="_blank">neil@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This looks like a good idea to me. I now wonder if we should go further<br>
and remove the depth parameter from create_texture_for_pbo, revert<br>
404660e3c7bc6 and document that SetTextureStorageForBufferObject doesn't<br>
work for array textures.<br>
<br>
I originally reviewed 404660e3 but now I understand the miptree layout<br>
code a bit better and I don't think it will work anyway. The layouting<br>
code has to insert some padding between array images to make it match<br>
various constraints that depend on the hardware generation. It is<br>
unlikely that these constraints will happen to match whatever layout is<br>
in the buffer object so I don't think it's really practical to make an<br>
array texture out of it.<br>
<br>
Seeing as we're doing a blit for each slice of the texture anyway we<br>
don't need to create an array texture as the source. That way it is easy<br>
to make it also cope with the image stride unpacking option.<br>
<br>
Regards,<br>
- Neil<br>
<div class="HOEnZb"><div class="h5"><br>
Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>> writes:<br>
<br>
> Changes PBO uploads and downloads to use a tall (height * depth) 2D texture<br>
> for blitting.  This fixes the bug where 2D_ARRAY, 3D, and CUBE_MAP_ARRAY<br>
> textures are not properly uploaded and downloaded.<br>
> ---<br>
>  src/mesa/drivers/common/meta_tex_subimage.c | 6 +++---<br>
>  1 file changed, 3 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/common/meta_tex_subimage.c b/src/mesa/drivers/common/meta_tex_subimage.c<br>
> index f4f7716..ee3295b 100644<br>
> --- a/src/mesa/drivers/common/meta_tex_subimage.c<br>
> +++ b/src/mesa/drivers/common/meta_tex_subimage.c<br>
> @@ -110,7 +110,7 @@ create_texture_for_pbo(struct gl_context *ctx, bool create_pbo,<br>
>     internal_format = _mesa_get_format_base_format(pbo_format);<br>
><br>
>     tex_image = _mesa_get_tex_image(ctx, tex_obj, tex_obj->Target, 0);<br>
> -   _mesa_init_teximage_fields(ctx, tex_image, width, height, depth,<br>
> +   _mesa_init_teximage_fields(ctx, tex_image, width, height * depth, 1,<br>
>                                0, internal_format, pbo_format);<br>
><br>
>     read_only = pbo_target == GL_PIXEL_UNPACK_BUFFER;<br>
> @@ -227,7 +227,7 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,<br>
>        _mesa_update_state(ctx);<br>
><br>
>        _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,<br>
> -                                 0, 0, width, height,<br>
> +                                 0, z * height, width, (z + 1) * height,<br>
>                                   xoffset, yoffset,<br>
>                                   xoffset + width, yoffset + height,<br>
>                                   GL_COLOR_BUFFER_BIT, GL_NEAREST);<br>
> @@ -349,7 +349,7 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,<br>
>        _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,<br>
>                                   xoffset, yoffset,<br>
>                                   xoffset + width, yoffset + height,<br>
> -                                 0, 0, width, height,<br>
> +                                 0, z * height, width, (z + 1) * height,<br>
>                                   GL_COLOR_BUFFER_BIT, GL_NEAREST);<br>
>     }<br>
><br>
> --<br>
> 2.1.0<br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div>