[Mesa-dev] [PATCH] mesa/readpix: don't clamp SNORM readings.

Marek Olšák maraeo at gmail.com
Tue May 10 08:37:00 UTC 2016


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Tue, May 10, 2016 at 5:36 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> The clamping code always clamps to 0..1, which for SNORM is
> incorrect. Just don't clamp at all in this case.
>
> This fixes a number of SNORM cases in:
> GL33-CTS.texture_size_promotion.functional
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/mesa/main/readpix.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
> index 1cb06c7..ac4f8b2 100644
> --- a/src/mesa/main/readpix.c
> +++ b/src/mesa/main/readpix.c
> @@ -119,6 +119,10 @@ _mesa_get_readpixels_transfer_ops(const struct gl_context *ctx,
>        }
>     }
>
> +   /* don't clamp signed normalized as they have a different range */
> +   if (_mesa_get_format_datatype(texFormat) == GL_SIGNED_NORMALIZED)
> +      transferOps &= ~IMAGE_CLAMP_BIT;
> +
>     /* If the format is unsigned normalized, we can ignore clamping
>      * because the values are already in the range [0,1] so it won't
>      * have any effect anyway.
> --
> 2.5.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list