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

Laura Ekstrand laura at jlekstrand.net
Fri Feb 20 13:30:54 PST 2015


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



More information about the mesa-dev mailing list