[Mesa-stable] [Mesa-dev] [PATCH] mesa: fix format conversion bug in get_tex_rgba_uncompressed()

Jason Ekstrand jason at jlekstrand.net
Tue Aug 30 06:18:19 UTC 2016


Seems reasonable,

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

On Aug 29, 2016 11:43 AM, "Brian Paul" <brianp at vmware.com> wrote:

> We need to set the need_convert flag with each loop iteration, not
> just when the rgba pointer is null.
>
> Bug reported by Markus Müller <mueller at imfusion.de> on mesa-users list.
> Fixes new piglit arb_texture_float-get-tex3d test.
>
> Cc: <mesa-stable at lists.freedesktop.org>
> ---
>  src/mesa/main/texgetimage.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
> index bd44c68..b900278 100644
> --- a/src/mesa/main/texgetimage.c
> +++ b/src/mesa/main/texgetimage.c
> @@ -495,13 +495,15 @@ get_tex_rgba_uncompressed(struct gl_context *ctx,
> GLuint dimensions,
>            */
>           if (format == rgba_format) {
>              rgba = dest;
> -         } else if (rgba == NULL) { /* Allocate the RGBA buffer only once
> */
> +         } else {
>              need_convert = true;
> -            rgba = malloc(height * rgba_stride);
> -            if (!rgba) {
> -               _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage()");
> -               ctx->Driver.UnmapTextureImage(ctx, texImage, img);
> -               return;
> +            if (rgba == NULL) { /* Allocate the RGBA buffer only once */
> +               rgba = malloc(height * rgba_stride);
> +               if (!rgba) {
> +                  _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage()");
> +                  ctx->Driver.UnmapTextureImage(ctx, texImage, img);
> +                  return;
> +               }
>              }
>           }
>
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20160829/120a43dc/attachment.html>


More information about the mesa-stable mailing list