Skip to content

Fix crash on browsers with no usable GPU backend - #210

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix-unsupported-gpu-init-crash
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix-unsupported-gpu-init-crash

Conversation

@sentry

@sentry sentry Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Fixes TypeError: Cannot read properties of null (reading 'getSupportedExtensions') during renderer initialization.

Root Cause

browserSupportsWebGPU() only verified "gpu" in navigator. In environments where navigator.gpu is exposed but no GPU adapter or WebGL2 context can actually be created (headless environments, disabled hardware acceleration, blocklisted GPUs), Three.js's WebGPURenderer.init() silently falls back to its WebGL2 backend. Because WebGL2 context creation also returns null, Three.js's WebGLExtensions constructor attempts to invoke this.gl.getSupportedExtensions() on the null context, throwing an unhandled TypeError.

Changes

  • src/renderer/webgpu-support.ts: Added probeRendererSupport() and assertRendererSupported() to probe for a WebGPU adapter and probe WebGL2 availability via a scratch canvas before attempting renderer creation. Added RendererUnsupportedError.
  • src/renderer/create-webgpu-renderer.ts: Asserts renderer support before instantiating THREE.WebGPURenderer to prevent falling into the Three.js WebGL2 null-context fallback crash.
  • src/hooks/use-editor-renderer.ts: Catches RendererUnsupportedError to display the friendly unsupported banner and reports it via Sentry captureMessage tagged with surface: "webgpu-unsupported", avoiding bogus webgpu-init exception captures.

Fixes SHADER-LAB-J

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry at no cost. You can adjust this setting at any time.

@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
shader-lab Ready Ready Preview Nov 11, 2026 10:24am UTC

This branch was successfully deployed

1 active deployment
Preview — ceb1d2f7 Deployed Nov 11, 2026 by vercel[bot]
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.

0 participants