[Mesa-dev] [PATCH 2/2] util: Make CLAMP turn NaN into MIN.

Roland Scheidegger sroland at vmware.com
Tue Jul 25 06:12:07 UTC 2017


Am 24.07.2017 um 11:44 schrieb Michel Dänzer:
> On 14/07/17 10:01 PM, Marek Olšák wrote:
>> Reviewed-by: Marek Olšák <marek.olsak at amd.com <mailto:marek.olsak at amd.com>>
> 
> This change broke piglit spec at ext_texture_lod_bias@lodbias for me with
> radeonsi (but not with llvmpipe).
> 
> 

The S_FIXED function needs some fixing (for r600 too). The compiler
takes full advantage of the fact that float to unsigned conversion is
undefined for negative floats, apparently.
The previous CLAMP would have used the state->lod_bias value if that was
equal to the MIN value (-16) (so no way for the compiler to screw it up)
whereas now it will use the -16 value.
(This also means it was probably broken before, for values which were
smaller than the min, albeit possibly noone cared as that would have
been outside the advertized lod bias limits.)
FWIW gcc generates a really terrible code for this (but that's not
really dependent on the new or old macro...)
(There's the same macro in mesa/main macros, but with signed numbers.)

Roland


More information about the mesa-dev mailing list