New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exploring asynchronous compilation of materials with Suspense #3073
Comments
This should be an addition in Drei at the very least. If you want something for Firefox, you can try a fence check to wait until GPU idle. This is a bit more crude, but it should offer comparable results if apps are idle on startup. Maybe this should be added to three now that parallel compile has finally been merged. https://gist.github.com/CodyJasonBennett/fedde93b69b8ecaefa402ee306189761 |
With this PR, three.js v158 supports a
compileAsync
method which can compile shaders and return a Promise that resolves when they're ready.Taking the Frosted glass example, my M1 Macbook spends several frames (74.6ms in total) blocked on shader compilation.
This new method sounds like a good fit for react-three-fiber's ability to leverage React's lifecycle management, to Suspend during compilation, then attach the objects to the scene.
Taking a step back, in my applications I don't mind if the 3D components 'arrive' a few frames later, but this kind of blocking of the main thread is visually noticeable.
I'm not too familiar with the internals of three or r3f at this level but I'd be happy to contribute, given some pointers in the right direction.
gl.render
?From what I can tell, this will only be an improvement for non-firefox browsers, due to the availability of the KHR_parallel_shader_compile extension.
The text was updated successfully, but these errors were encountered: