[Mesa-dev] [PATCH] texgetimage: consolidate 1D array handling code.

Ben Skeggs skeggsb at gmail.com
Tue Nov 10 22:34:55 PST 2015


On 11/11/2015 12:34 PM, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> This should fix the getteximage-depth test that currently asserts.
> 
> I was hitting problem with virgl as well in this area.
> 
> This moves the 1D array handling code to a single place.
This fixes the exceptions that some NVIDIA GPUs are raising when
executing getteximage-depth in non-debug builds that don't hit the
assertion.

Reviewed-by: Ben Skeggs <bskeggs at redhat.com>

Thanks!

> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/mesa/main/texgetimage.c | 24 +++++++++---------------
>  1 file changed, 9 insertions(+), 15 deletions(-)
> 
> diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
> index 945890a..200d1ca 100644
> --- a/src/mesa/main/texgetimage.c
> +++ b/src/mesa/main/texgetimage.c
> @@ -88,12 +88,6 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions,
>        return;
>     }
>  
> -   if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
> -      depth = height;
> -      height = 1;
> -   }
> -
> -   assert(zoffset + depth <= texImage->Depth);
>     for (img = 0; img < depth; img++) {
>        GLubyte *srcMap;
>        GLint srcRowStride;
> @@ -141,7 +135,6 @@ get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions,
>     assert(type == GL_UNSIGNED_INT_24_8 ||
>            type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
>  
> -   assert(zoffset + depth <= texImage->Depth);
>     for (img = 0; img < depth; img++) {
>        GLubyte *srcMap;
>        GLint rowstride;
> @@ -233,7 +226,6 @@ get_tex_ycbcr(struct gl_context *ctx, GLuint dimensions,
>  {
>     GLint img, row;
>  
> -   assert(zoffset + depth <= texImage->Depth);
>     for (img = 0; img < depth; img++) {
>        GLubyte *srcMap;
>        GLint rowstride;
> @@ -431,13 +423,6 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
>     bool needsRebase;
>     void *rgba = NULL;
>  
> -   if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
> -      depth = height;
> -      height = 1;
> -      zoffset = yoffset;
> -      yoffset = 0;
> -   }
> -
>     /* Depending on the base format involved we may need to apply a rebase
>      * transform (for example: if we download to a Luminance format we want
>      * G=0 and B=0).
> @@ -737,6 +722,15 @@ _mesa_GetTexSubImage_sw(struct gl_context *ctx,
>        pixels = ADD_POINTERS(buf, pixels);
>     }
>  
> +   if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
> +      depth = height;
> +      height = 1;
> +      zoffset = yoffset;
> +      yoffset = 0;
> +      assert(zoffset + depth <= texImage->Height);
> +   } else
> +      assert(zoffset + depth <= texImage->Depth);
> +
>     if (get_tex_memcpy(ctx, xoffset, yoffset, zoffset, width, height, depth,
>                        format, type, pixels, texImage)) {
>        /* all done */
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151111/958979b1/attachment.sig>


More information about the mesa-dev mailing list