[Mesa-dev] [PATCH 1/7] mesa: add ASTC 2D LDR decoder

Andres Gomez agomez at igalia.com
Tue Jul 31 23:03:26 UTC 2018


On Mon, 2018-07-23 at 19:52 -0400, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>  src/mesa/Makefile.sources          |    2 +
>  src/mesa/main/formats.c            |   42 +
>  src/mesa/main/formats.h            |    3 +
>  src/mesa/main/texcompress_astc.cpp | 1871 ++++++++++++++++++++++++++++
>  src/mesa/main/texcompress_astc.h   |   47 +
>  src/util/half_float.c              |   59 +
>  src/util/half_float.h              |    5 +
>  7 files changed, 2029 insertions(+)
>  create mode 100644 src/mesa/main/texcompress_astc.cpp
>  create mode 100644 src/mesa/main/texcompress_astc.h
> 

...

> diff --git a/src/util/half_float.c b/src/util/half_float.c
> index 4df64c2ccf9..588f050d924 100644
> --- a/src/util/half_float.c
> +++ b/src/util/half_float.c
> @@ -1,14 +1,16 @@

...

> +
> +/**
> +  * Takes a uint16_t, divides by 65536, converts the infinite-precision
> +  * result to fp16 with round-to-zero. Used by the ASTC decoder.
> +  */
> +uint16_t _mesa_uint16_div_64k_to_half(uint16_t v)
> +{
> +   /* Zero or subnormal. Set the mantissa to (v << 8) and return. */
> +   if (v < 4)
> +      return v << 8;
> +
> +   /* Count the leading 0s in the uint16_t */
> +   int n = __builtin_clz(v) - (sizeof(unsigned int) - sizeof(uint16_t)) * 8;

Marek, this seems to have broken the AppVeyor Windows build:
https://ci.appveyor.com/project/mesa3d/mesa/build/8475

It looks like you need some guards for __builtin_clz, as in:
https://cgit.freedesktop.org/mesa/mesa/tree/src/util/bitscan.h#n210

-- 
Br,

Andres


More information about the mesa-dev mailing list