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

WebGPURenderer: Handle Device Lost Event #29767

Conversation

RenaudRohlinger
Copy link
Collaborator

@RenaudRohlinger RenaudRohlinger commented Oct 30, 2024

Description
Handle device/context Lost Event on both backends of the WebGPURenderer.

By default a formatted error will appear like so:
Screenshot 2024-10-30 at 11 37 31
And just like in the WebGLRenderer, both loop will throw an early return.

Also added a way to easily handle the error for the developer:

renderer.onDeviceLost = ( info ) => console.log( 'Device Lost', info );

Screenshot 2024-10-30 at 11 38 08

Even better, unlike WebGL, we could even gracefully restart the app/device in WebGPU:

renderer.onDeviceLost = ( _info ) => await renderer.init()

This contribution is funded by Utsubo

Copy link

github-actions bot commented Oct 30, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 691.67
171.43
691.67
171.43
+0 B
+0 B
WebGPU 820.87
221.46
821.69
221.79
+816 B
+325 B
WebGPU Nodes 820.38
221.33
821.2
221.66
+816 B
+328 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 463.82
112.17
463.82
112.17
+0 B
+0 B
WebGPU 541.7
146.38
542.52
146.73
+816 B
+343 B
WebGPU Nodes 497.7
136.21
498.52
136.55
+816 B
+343 B

@Mugen87 Mugen87 added this to the r170 milestone Oct 30, 2024
@RenaudRohlinger RenaudRohlinger merged commit ab048e6 into mrdoob:dev Oct 31, 2024
12 checks passed
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

Successfully merging this pull request may close these issues.

2 participants