On 6 June 2012 10:31, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 06/06/2012 05:16 AM, Olivier Galibert wrote:<br>
> On Tue, Jun 05, 2012 at 04:51:54PM -0700, Paul Berry wrote:<br>
>> The best idea I've got so far would be a shader_runner test with a fragment<br>
>> shader that computes dFdx(asin(x)), compares it to the theoretical closed<br>
>> form derivative of asin(x) (which is 1/sqrt(1-x^2)), and draws red pixels<br>
>> if the result is outside a certain error tolerance. We'd probably want to<br>
>> use a relative error (since the derivative of asin(x) can get quite large)<br>
>> and stop a bit shy of the endpoints where it goes to infinity.<br>
><br>
> Can't you take the perfectly reasonable hypothesis that the system's<br>
> asin is precise, and upload something like a 256x256 R32FG32FB32FA32F<br>
> texture with reference values? 262144 testing points should be good<br>
> enough :-)<br>
><br>
> And that's something that generalizes easily to all the functions you<br>
> may want to test on a segment.<br>
><br>
> OG.<br>
<br>
</div></div>There's at least one problem with that: if the hardware only supports N<br>
active textures at once, and the application already asked to use all N<br>
of those...you don't have a texture available for this. Which is maybe<br>
not a big deal if you just need one, say, for asin...but if you want one<br>
for asin, one for noise, one for ...<br>
<br>
I suppose you could combine them into one texture. Still, it's kind of<br>
annoying to deal with. Also, arithmetic instructions tend to be vastly<br>
cheaper than texture lookups, so you can probably get a fairly nice<br>
algebraic approximation in that amount of space.<br>
<br>
</blockquote></div><br>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().<br>
<br>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.<br>