Presently, when compiling shaders – three.js always checks for compile errors, this is typically the biggest time hog, and if you have a decent number of them (shaders that is) – it tends to cause considerable FPS spikes. For example, in my game it’s about a series of very janky spikes just just as you first load and try to move the camera.
and here’s the aggregate of the entire game load and first couple of seconds of gameplay:
as you can see, just checking for errors and retrieving error messages takes up close to 800ms.
I think it’s great to have these checks during development and it’s great to be able to keep them, but in production a lot of the time they can be irrelevant or at least it’s a developer’s call whether to get better performance or get better error reporting.
I believe it would be beneficial for developers to be able to opt-out from these error checks/reports.
There’s a separate point, that these checks can be done asynchronously in most browsers. See @toji ‘s demo: http://toji.github.io/shader-perf/
Also, I’m aware of WebGLRenderer.compile, that’s a separate point, good fit for static scenes – I’m glad we have this feature.
Maybe
WebGLRenderer.programCheckEnabled
. Default would betrue
of course^^.