Skip to content

fix(exporter): default Lightning render backend to webgl before webgpu - #1

Merged
kutmur merged 1 commit into
mainfrom
fix/linux-lightning-webgl-backend
Sep 8, 2026
Merged

fix(exporter): default Lightning render backend to webgl before webgpu#1
kutmur merged 1 commit into
mainfrom
fix/linux-lightning-webgl-backend

Conversation

@kutmur

@kutmur kutmur commented Sep 8, 2026

Copy link
Copy Markdown
Owner

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

  • New Feature
  • Bug Fix
  • Refactor / Code Cleanup
  • Documentation Update
  • Other (please specify)

Related Issue(s)

Screenshots / Video

Screenshot (if applicable):

![Screenshot Description](path/to/screenshot.png)

Video (wherever possible):

<video src="path/to/video.mp4" controls width="600"></video>

Testing Guide

Checklist

  • I have performed a self-review of my code.
  • I have added any necessary screenshots or videos.
  • I have linked related issue(s) and updated the changelog if applicable.

Thank you for contributing!

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.
@kutmur
kutmur requested a lite review from Copilot September 8, 2026 14:52
@kutmur
kutmur merged commit 2f2b652 into main Sep 8, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 constructing ModernFrameRenderer from ModernVideoExporter if 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";

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