[Mesa-stable] [Mesa-dev] [PATCH 1/5] st/nine: Clamp RCP when 0*inf!=0

Roland Scheidegger sroland at vmware.com
Wed Sep 12 21:43:08 UTC 2018


Am 12.09.2018 um 08:31 schrieb Axel Davy:
> On 9/12/18 8:17 AM, Axel Davy wrote:
>>
>> The goal is to catch inf and -inf and replace them by FLT_MAX and
>> -FLT_MAX.
>>
>> Without, the NaN would appear when doing mul or mad.
Ah I somehow completely missed this (but indeed this code will replace
nans with flt_max, I guess though it's fine as long as you try to avoid
getting nans as inputs there in the first place).


>>
>> Axel
>>
>>
>>
> I small precision I want to add: This is not the only place clamping
> makes a difference.
> 
> Indeed else MUL_ZERO_WINS would be safe to use and remove all the clamping.
> 
> 
> The rasterizers can produce NaN when given Inf in the vertex shader on
> some devices for example,
> 
> and I think on some devices inf and FLT_MAX give different color in the
> pixel shader.
> 
> 
> Thus why I want to test carefully what do the other vendors for all the
> shader versions (we know already there are
> 
> behaviour changes for some) and check with the behaviours mentionned
> above, before removing the clamps when MUL_ZERO_WINS.
Yes it's all quite a mess. d3d9 rules are awkward (if they are even
documented), whereas gl may do whatever (personally I would consider at
least for core contexts everything not following ieee754 rules a bug,
well maybe not for gles...).

Roland


> 
> 
> 
> Axel
> 



More information about the mesa-stable mailing list