Skip to content
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

WebGPU support #3352

Closed
wcandillon opened this issue Sep 13, 2024 · 5 comments
Closed

WebGPU support #3352

wcandillon opened this issue Sep 13, 2024 · 5 comments

Comments

@wcandillon
Copy link

Starting with r167, WebGPU support in three-fiber broke. @aarongrider created a reproducible example here. We thought we would open an issue to learn more about this topic and track it.

Interestingly enough, @aarongrider and I are not particularly interested in WebGPU support in three-fiber. What we really want is a truly portable reconciler API that we can use in any context. We are writing our own Canvas implementation and ran into runtime issues while doing so. This led us to try WebGPU support in three-fiber.

Our goal is to run three-fiber on React Native with WebGPU. To achieve this, we need to write our own Canvas element (and use the web version of three-fiber, not the native one). Ultimately, we only need the reconciler. We plan to run the reconciler in its own worklet thread, use Reanimated for animations (e.g., no useFrame), use gesture-handler for gestures, handle asset loading outside of three-fiber, and more. We had built a tiny working example, but encountered several runtime issues with more advanced examples.

@CodyJasonBennett
Copy link
Member

You've probably been impacted by mrdoob/three.js#29156 as that breaks compatibility with everything unless you change bundler resolution for three. This is an upstream issue which must be resolved, but no further action is needed than using an environment which supports ESM and top-level-await, and constructing the renderer with <Canvas gl={(canvas) => new WebGPURenderer({ canvas })} />. Some further context: https://x.com/Cody_J_Bennett/status/1821555844980285515.

@wcandillon
Copy link
Author

wcandillon commented Sep 13, 2024 via email

@CodyJasonBennett
Copy link
Member

There's nothing mystical or different about how three behaves when it interacts with R3F, so I would strongly suggest you start with vanilla three and get that working, and don't change that when you introduce the R3F canvas. I don't have the time to debug your app, but there's definitely something wrong or different if you're seeing any runtime difference at all, with mrdoob/three.js#29156 as a key culprit.

@wcandillon
Copy link
Author

wcandillon commented Sep 13, 2024 via email

@wcandillon
Copy link
Author

wcandillon commented Sep 13, 2024

completed in #3353

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants