Show a clear error when WebGPU is unavailable during SOG and viewer export#956
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves SOG / viewer export failure handling when WebGPU is unavailable by introducing a dedicated error type during GPU device creation and showing a localized, actionable popup message instead of a cryptic TypeError.
Changes:
- Add
WebGPUUnavailableErrorand throw it fromcreateGpuDevice()for multiple WebGPU device-creation failure modes. - Catch
WebGPUUnavailableErrorin the export flow to show a localized “WebGPU unavailable” message. - Add the new localized string to all nine supported locales.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| static/locales/zh-CN.json | Adds localized popup.webgpu-unavailable message (Chinese). |
| static/locales/ru.json | Adds localized popup.webgpu-unavailable message (Russian). |
| static/locales/pt-BR.json | Adds localized popup.webgpu-unavailable message (Brazilian Portuguese). |
| static/locales/ko.json | Adds localized popup.webgpu-unavailable message (Korean). |
| static/locales/ja.json | Adds localized popup.webgpu-unavailable message (Japanese). |
| static/locales/fr.json | Adds localized popup.webgpu-unavailable message (French). |
| static/locales/es.json | Adds localized popup.webgpu-unavailable message (Spanish). |
| static/locales/en.json | Adds localized popup.webgpu-unavailable message (English). |
| static/locales/de.json | Adds localized popup.webgpu-unavailable message (German). |
| src/splat-serialize.ts | Introduces WebGPUUnavailableError and improves WebGPU device creation error signaling for SOG/viewer export. |
| src/file-handler.ts | Shows a friendly, localized popup message when export fails due to WebGPU unavailability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #934
Exporting to SOG (or the HTML viewer, which bundles SOG) requires a WebGPU device for spherical harmonic k-means clustering. On systems where WebGPU is unavailable — no
navigator.gpu, orrequestAdapter()returning null, as on the reporter's Ubuntu/Chrome setup — the export failed with the cryptic popup "Cannot read properties of null (reading 'features') while saving file" under an "Error Loading File" header.createGpuDevicenow throws a dedicatedWebGPUUnavailableErrorfor every way device creation can fail: missingnavigator.gpu,createDevice()throwing on a null adapter, andcreateDevice()resolving without creating a device (blocklisted adapters). The underlying error is still logged to the console for debugging. The export handler catches this error type and shows a localized, actionable message instead of the raw error text: "This export requires WebGPU, which is not available in this browser. Please try a recent version of Chrome, Edge or Safari." The new string is translated in all nine locales.Verified in the browser by simulating both failure modes (removing
navigator.gpu, and stubbingrequestAdapter()to resolve null, which reproduces the exact TypeError from #934), and by confirming a normal SOG export still succeeds with a working adapter.