On 01/12/2017 02:47 PM, Matteo Bruni wrote: > 2017-01-12 23:41 GMT+01:00 Axel Davy <axel.d...@ens.fr>: >>> Do you refer to the d3d9 MAD or the hardware instruction? If the >>> former, just generating MUL and ADD separately should do the trick. In >>> the latter case, I guess that means the "NaN switch" should also >>> affect code generation (although I think that should be already >>> covered by the "precise" qualifier.) >>> >> all radeon card released so far have special instructions for both mul and >> mad to have 0*inf = 0. >> >> >> I guess you'd need some gl extension to use them if available. > > I see. Does it need to be a separate extension though? I.e. isn't it > enough if the driver uses those special instructions when we don't > want NaN and use the normal instructions otherwise?
Code generation is a complex matter. Generating a separate multiply may reduce register pressure and be better that generating a MAD. This is part of the reason GLSL 4.20 added the fma() built-in function. This provides some uniformity among what implementations can (correctly) do, but it limits some optimization opportunities. Freedom of the system to optimize vs. uniformity of results is a pretty classic trade off. > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev