I’ve just pushed Jax v1.0.1 up. As the version number implies, this is not a huge release — but a lot of effort has gone into it!
This is a bugfix release that addresses framerate and other issues with some driver sets. It also makes Jax shadowmapping smarter. When what would be considered a fatal error is encountered while generating a shadow map, shadowmaps will silently be disabled on a per-light basis so that rendering can continue, rather than letting the scene crash. Note that fatal errors encountered during the main rendering pass are still fatal.
This release should serve as a word of warning to everyone writing WebGL shaders, whether or not you use Jax. Video drivers are notorious for their bugs, which are incredibly difficult to track down and usually don’t seem to make any sense whatsoever when you finally discover what’s causing them.
In this case, the issues were all caused by the built-in Jax lighting shaders. When I wrote them, my original plan was to take every opportunity to return from a given function as early as possible, thus preventing unnecessary GPU usage. Unfortunately, it was the very act of returning that was causing the issue.
So for all you other shader writers out there, be aware of this very simple caveat: returning early from a void function can cause some serious issues for some users. The only solution I could find was to redesign the functions to use conditions instead of returning outright.
(I’ve read elsewhere that even if-conditions can have problems on some hardware; however, I’ve seen nothing [yet] to indicate that any WebGL-compatible hardware is effected by this, so I believe switching to conditions was still the right answer.)
Hopefully this issue will be resolved by the various video card manufacturers out there in the long term; for now, I’m afraid all we can do is gripe about it.
For the full discussion regarding this bug, see:
EDIT: P.S. – it seems really odd for something as fundamental as `return;` to crash an application. If you have more information regarding this, please let me know so I can make adequate corrections! Thanks!
Upgrading Your Application