fix(exporter): default Lightning render backend to webgl before webgpu - #1
Merged
Merged
Conversation
On Linux, ModernVideoExporter passed preferredRenderBackend as undefined to ModernFrameRenderer. Because navigator.gpu exists in Electron, PixiJS then chose webgpu first (order [webgpu, webgl]). requestAdapter succeeds but later bind-group setup crashes with '_resourceType' undefined, failing every Lightning export regardless of resolution/quality. Wire the existing helper getDefaultLightningRenderBackend() (which returns 'webgl') into both the exporter's renderer construction and the renderer's fallback backendOrder. The default order is now [webgl, webgpu] matching the stable Legacy pipeline, with webgpu kept as secondary fallback if webgl init itself fails. Both-init failure still throws a detailed 'Export issue' dialog. Tests: add coverage that undefined preference resolves to webgl and that webgpu is used only as fallback when webgl fails.
There was a problem hiding this comment.
🟡 Changes recommended
There are a couple of concrete issues in the updated renderer selection logic/import placement that should be addressed before merging to avoid inconsistent conventions and potentially noisier error output.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes Lightning exports on Linux/Electron by ensuring the modern exporter and renderer default to a stable WebGL-first Pixi renderer selection, avoiding unintended WebGPU-first initialization when no explicit backend preference is provided.
Changes:
- Use
getDefaultLightningRenderBackend()when constructingModernFrameRendererfromModernVideoExporterif no preference is set. - Default the modern renderer’s backend selection to WebGL-first (with WebGPU as fallback) when the preference is unset.
- Add tests validating the WebGL-first default and WebGPU fallback behavior when WebGL init fails.
File summaries
| File | Description |
|---|---|
| src/lib/exporter/modernVideoExporter.ts | Ensures the exporter passes a default render backend instead of undefined. |
| src/lib/exporter/modernFrameRenderer.ts | Updates renderer backend defaulting and backend order resolution logic. |
| src/lib/exporter/modernFrameRenderer.test.ts | Adds test coverage for default backend selection and fallback behavior. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+643
to
+646
| const preferredRenderBackend = | ||
| this.config.preferredRenderBackend ?? getDefaultLightningRenderBackend(); | ||
| const backendOrder: ExportRenderBackend[] = | ||
| preferredRenderBackend === "webgl" | ||
| ? ["webgl", "webgpu"] | ||
| : preferredRenderBackend === "webgpu" | ||
| ? ["webgpu", "webgl"] | ||
| : typeof navigator !== "undefined" && "gpu" in navigator | ||
| ? ["webgpu", "webgl"] | ||
| : ["webgl"]; | ||
| preferredRenderBackend === "webgpu" ? ["webgpu", "webgl"] : ["webgl", "webgpu"]; |
Comment on lines
101
to
105
| const TEMPORAL_ZOOM_MOTION_BLUR_ENABLED = false; | ||
|
|
||
| import { getDefaultLightningRenderBackend } from "./backendPolicy"; | ||
| import type { ExportRenderBackend } from "./types"; | ||
|
|
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.
On Linux, ModernVideoExporter passed preferredRenderBackend as undefined to ModernFrameRenderer. Because navigator.gpu exists in Electron, PixiJS then chose webgpu first (order [webgpu, webgl]). requestAdapter succeeds but later bind-group setup crashes with '_resourceType' undefined, failing every Lightning export regardless of resolution/quality.
Wire the existing helper getDefaultLightningRenderBackend() (which returns 'webgl') into both the exporter's renderer construction and the renderer's fallback backendOrder. The default order is now [webgl, webgpu] matching the stable Legacy pipeline, with webgpu kept as secondary fallback if webgl init itself fails. Both-init failure still throws a detailed 'Export issue' dialog.
Tests: add coverage that undefined preference resolves to webgl and that webgpu is used only as fallback when webgl fails.
Pull Request Template
Description
Motivation
Type of Change
Related Issue(s)
Screenshots / Video
Screenshot (if applicable):
Video (wherever possible):
Testing Guide
Checklist
Thank you for contributing!