<div dir="ltr">The Meta PBO upload path does not exist in 10.4, so we don't need to worry about a backport.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 3, 2015 at 6:01 PM, Emil Velikov <span dir="ltr"><<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 24 February 2015 at 23:20, Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>> wrote:<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>
> Removes the option to use a 2D ARRAY texture for the PBO during upload and<br>
> download.  This option didn't work because the miptree couldn't be set up<br>
> reliably.<br>
><br>
> v2: Review from Jason Ekstrand and Neil Roberts:<br>
>    -Delete the depth parameter from create_texture_for_pbo<br>
>    -Abandon the option to create a 2D ARRAY texture in create_texture_for_pbo<br>
> ---<br>
>  src/mesa/drivers/common/meta_tex_subimage.c | 26 +++++++++++++++++---------<br>
>  1 file changed, 17 insertions(+), 9 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 2d2b9d8..b659426 100644<br>
> --- a/src/mesa/drivers/common/meta_tex_subimage.c<br>
> +++ b/src/mesa/drivers/common/meta_tex_subimage.c<br>
> @@ -44,7 +44,7 @@<br>
><br>
>  static struct gl_texture_image *<br>
>  create_texture_for_pbo(struct gl_context *ctx, bool create_pbo,<br>
> -                       GLenum pbo_target, int width, int height, int depth,<br>
> +                       GLenum pbo_target, int width, int height,<br>
>                         GLenum format, GLenum type, const void *pixels,<br>
>                         const struct gl_pixelstore_attrib *packing,<br>
>                         GLuint *tmp_pbo, GLuint *tmp_tex)<br>
> @@ -57,8 +57,7 @@ create_texture_for_pbo(struct gl_context *ctx, bool create_pbo,<br>
>     struct gl_texture_image *tex_image;<br>
>     bool read_only;<br>
><br>
> -   if ((packing->ImageHeight != 0 && packing->ImageHeight != height) ||<br>
> -       packing->SwapBytes ||<br>
> +   if (packing->SwapBytes ||<br>
>         packing->LsbFirst ||<br>
>         packing->Invert)<br>
>        return NULL;<br>
> @@ -99,7 +98,6 @@ create_texture_for_pbo(struct gl_context *ctx, bool create_pbo,<br>
><br>
>     _mesa_GenTextures(1, tmp_tex);<br>
>     tex_obj = _mesa_lookup_texture(ctx, *tmp_tex);<br>
> -   tex_obj->Target = depth > 1 ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;<br>
>     _mesa_initialize_texture_object(ctx, tex_obj, *tmp_tex, GL_TEXTURE_2D);<br>
>     /* This must be set after _mesa_initialize_texture_object, not before. */<br>
>     tex_obj->Immutable = GL_TRUE;<br>
> @@ -109,7 +107,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, 1,<br>
>                                0, internal_format, pbo_format);<br>
><br>
>     read_only = pbo_target == GL_PIXEL_UNPACK_BUFFER;<br>
> @@ -169,9 +167,14 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,<br>
>        return true;<br>
>     }<br>
><br>
> +   /* Only accept tightly packed pixels from the user. */<br>
> +   if (packing->ImageHeight != 0 && packing->ImageHeight != height)<br>
> +      return false;<br>
> +<br>
> +   /* For arrays, use a tall (height * depth) 2D texture. */<br>
>     pbo_tex_image = create_texture_for_pbo(ctx, create_pbo,<br>
>                                            GL_PIXEL_UNPACK_BUFFER,<br>
> -                                          width, height, depth,<br>
> +                                          width, height * depth,<br>
>                                            format, type, pixels, packing,<br>
>                                            &pbo, &pbo_tex);<br>
>     if (!pbo_tex_image)<br>
> @@ -225,7 +228,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>
> @@ -285,8 +288,13 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,<br>
>        return true;<br>
>     }<br>
><br>
> +   /* Only accept tightly packed pixels from the user. */<br>
> +   if (packing->ImageHeight != 0 && packing->ImageHeight != height)<br>
> +      return false;<br>
> +<br>
> +   /* For arrays, use a tall (height * depth) 2D texture. */<br>
>     pbo_tex_image = create_texture_for_pbo(ctx, false, GL_PIXEL_PACK_BUFFER,<br>
> -                                          width, height, depth,<br>
> +                                          width, height * depth,<br>
>                                            format, type, pixels, packing,<br>
>                                            &pbo, &pbo_tex);<br>
>     if (!pbo_tex_image)<br>
> @@ -347,7 +355,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>
</div></div>Hi Laura,<br>
<br>
This patch and 03 from the series, is rather impossible to pick for<br>
the 10.4 series. The code has changed drastically since 3+ months ago.<br>
Can you send over a backport against the 10.4 tree.<br>
<br>
Thanks<br>
<span class="HOEnZb"><font color="#888888">Emil<br>
</font></span></blockquote></div><br></div>