[Mesa-dev] [PATCH 2/4] common: Correct PBO 2D_ARRAY handling.
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@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/4] common: Correct PBO 2D_ARRAY handling.
This is mostly correct and it's a good solution. The only problem is that it doesn't handle the skipRows packing property properly. This property tells the driver the stride (in rows) between image planes in the data. Most of the places where depth is used below, we should be using the stride (in rows) between images. Look at the _mesa_get_image_stride familiy of functions to see exactly how to handle this. On Fri, Feb 20, 2015 at 4:30 PM, Laura Ekstrand wrote: > 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@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/4] common: Correct PBO 2D_ARRAY handling.
There needs to be some corresponding Piglit test to guarantee that skip pixels is really a problem here. Otherwise, I'm flying blind trying to fix it. On Fri, Feb 20, 2015 at 5:04 PM, Jason Ekstrand wrote: > This is mostly correct and it's a good solution. The only problem is that > it doesn't handle the skipRows packing property properly. This property > tells the driver the stride (in rows) between image planes in the data. > Most of the places where depth is used below, we should be using the stride > (in rows) between images. Look at the _mesa_get_image_stride familiy of > functions to see exactly how to handle this. > > On Fri, Feb 20, 2015 at 4:30 PM, Laura Ekstrand > wrote: > >> 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@lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/mesa-dev >> > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev