[Mesa-dev] [PATCH] texgetimage: fix regression with shadow 1d array

Brian Paul brianp at vmware.com
Wed Oct 28 09:03:21 PDT 2015


On 10/27/2015 08:26 PM, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> since 1ad305b612f389fb04c6d51847427d5ec72fae03
> Brian Paul <brianp at vmware.com>
> Date:   Tue Jul 21 18:35:38 2015 -0600
>
>      mesa: plumb offset/size parameters through GetTexSubImage code
>
> I found this testing virgl which exercises a bunch of these
> in it's fallbacks.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>   src/mesa/main/texgetimage.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
> index 682b727..b4321fb 100644
> --- a/src/mesa/main/texgetimage.c
> +++ b/src/mesa/main/texgetimage.c
> @@ -91,9 +91,10 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions,
>      if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
>         depth = height;
>         height = 1;
> -   }
> +      assert(zoffset + depth <= texImage->Height);
> +   } else
> +      assert(zoffset + depth <= texImage->Depth);
>
> -   assert(zoffset + depth <= texImage->Depth);
>      for (img = 0; img < depth; img++) {
>         GLubyte *srcMap;
>         GLint srcRowStride;
>

What exactly are the parameters to glGetTextureSubImage() that hits this?

zoffset should always be zero for TEXTURE_1D_ARRAY, so I think we should 
be assigning zoffset = yoffset for the 1D array case, as we do in 
get_tex_rgba_uncompressed().

Also, there's several other functions, like get_tex_depth_stencil(), 
get_tex_stencil(), etc. that would seem to need similar y/z height/depth 
translation for 1D_ARRAY.  In fact, maybe this should all be done in 
_mesa_GetTexSubImage_sw() before any of these functions are called.

Do you have time to look into that?

-Brian



More information about the mesa-dev mailing list