On 6 June 2012 10:31, Kenneth Graunke <kenn...@whitecape.org> wrote: > On 06/06/2012 05:16 AM, Olivier Galibert wrote: > > On Tue, Jun 05, 2012 at 04:51:54PM -0700, Paul Berry wrote: > >> The best idea I've got so far would be a shader_runner test with a > fragment > >> shader that computes dFdx(asin(x)), compares it to the theoretical > closed > >> form derivative of asin(x) (which is 1/sqrt(1-x^2)), and draws red > pixels > >> if the result is outside a certain error tolerance. We'd probably want > to > >> use a relative error (since the derivative of asin(x) can get quite > large) > >> and stop a bit shy of the endpoints where it goes to infinity. > > > > Can't you take the perfectly reasonable hypothesis that the system's > > asin is precise, and upload something like a 256x256 R32FG32FB32FA32F > > texture with reference values? 262144 testing points should be good > > enough :-) > > > > And that's something that generalizes easily to all the functions you > > may want to test on a segment. > > > > OG. > > There's at least one problem with that: if the hardware only supports N > active textures at once, and the application already asked to use all N > of those...you don't have a texture available for this. Which is maybe > not a big deal if you just need one, say, for asin...but if you want one > for asin, one for noise, one for ... > > I suppose you could combine them into one texture. Still, it's kind of > annoying to deal with. Also, arithmetic instructions tend to be vastly > cheaper than texture lookups, so you can probably get a fairly nice > algebraic approximation in that amount of space. > > There's some missing context here. Ian was asking for suggestions on how to *test* asin(), not how to implement it. As a testing technique Olivier's suggestion would be ok, although not ideal because it relies on floating point textures--it would be nice if floating point texture support weren't required to run our piglit tests for asin().
Also, it's not entirely clear to me from the original context, but I thought Ian was looking for suggestions on how to test that dFdx(asin(x)) behaves well near x=0. Testing asin(x) at 262144 points won't necessarily validate that the derivative behaves well, because it's possible that a small discontinuity near x=0 could result in a very badly behaved derivative even if asin(x) is within tolerance for all x.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev