Skip to content

fix(shader): keep shader handles within their WebGL context - #3672

Merged
miga-heygen merged 1 commit into
mainfrom
fix/shader-context-ownership
Sep 8, 2026
Merged

miga-heygen merged 1 commit into
mainfrom
fix/shader-context-ownership

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

Shader transitions now initialize correctly when a second WebGL context is created.

Why

A module-global vertex shader belonged to the first context. Reusing it in another context failed program linking. The old lifecycle rewrite is unnecessary for this specific defect.

Related: #3005

How

Use the existing per-context program creation helper instead of caching a shader globally. Context-loss handling and lazy allocation are unchanged.

Test plan

  • New ownership regression fails before the fix; all13 shader-package tests pass.
  • Actual-source Chrome probe: two distinct contexts link and render across alternating calls, with no WebGL errors; rerun on current main a93106a.
  • Independent review, package typecheck, lint/format/Fallow and commit hooks pass.
  • Physical GPU matrix/full producer render: not run; browser proof uses SwiftShader.

Post-Deploy Monitoring & Validation

On the next shader integration run, exercise two independently mounted contexts and watch for program-link failures. Expected: both render. Revert this narrow helper change if a new initialization regression appears.

@miga-heygen miga-heygen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removing the module-level cached vertex shader fixes cross-context handle reuse. The existing createProgramWithVertex already creates both shaders fresh. Test confirms multi-context safety. — Miga

@miga-heygen
miga-heygen enabled auto-merge (squash) September 8, 2026 18:09
@miga-heygen
miga-heygen merged commit 65cc1d6 into main Sep 8, 2026
47 checks passed
@miga-heygen
miga-heygen deleted the fix/shader-context-ownership branch September 8, 2026 18:12
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