glsl: rewrite sqrt(x) intrinsic to handle x=0
authorBrian Paul <brianp@vmware.com>
Wed, 30 Sep 2009 00:57:13 +0000 (18:57 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 30 Sep 2009 00:57:13 +0000 (18:57 -0600)
commit65765c9f2c5d3568608bde57db0bf44d6b724755
tree9825cbfd5c239e2bef19d1ea40b1fc1cb743592c
parent3c794e45b02c66ce3f52fe359f733e4d7d2ce315
glsl: rewrite sqrt(x) intrinsic to handle x=0

Since sqrt() is basically implemented in terms of RSQ/RCP we'll do a
divide by zero if x=0 and wind up with unpredictable results.
Now use CMP instruction to test for x<=0 and return zero in that case.
src/mesa/shader/slang/library/slang_common_builtin.gc