Am 20.02.2013 11:39, schrieb Aras Pranckevicius: > > Why did glsl implement this really as x * (1 - a) + y * a? > The usual way for lerp would be (y - x) * a + x, i.e. two ops for most > gpus (sub+mad, or sub+mul+add). But I'm wondering if that sacrifices > precision > > > Yes. > http://fgiesen.wordpress.com/2012/08/15/linear-interpolation-past-present-and-future/
Ah ok. Also (from the comments) the other form could also be better in some circumstances, but I guess getting accurate results for weight == 1.0 is really more important. (Also it looks like at least some infinity cases woldn't get the same result neither, if y and a are ordinary numbers and x is +infinity, the first equation would yield +/- infinity depending on a, but the second would result (again depending on a) either in +infinity or NaN.) If those properties are important might have to use that for TGSI_OPCODE_LRP at some point... Roland _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev