GpuProgram entry-point concatenation aliases distinct WebGPU pipelines
GpuProgram entry-point concatenation aliases distinct WebGPU pipelines
Current behavior
Two valid GpuProgram instances built from the same WGSL module can receive the same internal _layoutKey when their vertex and fragment entry-point names concatenate to the same string.
For example:
- Program A: vertex
ab, fragmentc - Program B: vertex
a, fragmentbc
Both become abc. The pipeline cache then returns Program A's pipeline for Program B. Program B executes the wrong vertex and fragment entry points.
Expected behavior
Distinct vertex/fragment entry-point pairs must receive distinct program and pipeline identities.
Public runnable reproduction
- Repository: https://github.com/mf3493297-png/pixijs-bug-reproductions
- Reproduction: https://github.com/mf3493297-png/pixijs-bug-reproductions/tree/main/gpu-entrypoint-key-collision
Run:
npm ci
npm startOpen http://127.0.0.1:4173/gpu-entrypoint-key-collision/ in Firefox. It prints:
REPRODUCED: {"firstKey":1,"secondKey":1,"created":["ab/c"],"firstMarker":"ab/c","secondMarker":"ab/c","samePipeline":true}Verified in headed Camoufox with no page errors.
Neighboring controls
- Both entry-point pairs exist in one valid WGSL module.
GpuProgram.from()returns two distinct program instances because its outer cache key contains separators.- A non-colliding pair creates a second pipeline as expected.
- With the colliding pair,
_createPipeline()runs only forab/c; requestinga/bcreturns that exact same pipeline object.
Root cause
GpuProgram.from() safely separates fields in its object cache key, but each constructed program computes _layoutKey differently:
const bigKey = vertex.source + fragment.source + vertex.entryPoint + fragment.entryPoint;
this._layoutKey = createIdFromString(bigKey, 'program');There are no length prefixes or delimiters between the four values. Distinct tuples can therefore produce identical strings.
PipelineSystem uses program._layoutKey directly in its pipeline key. The second tuple hits the first tuple's cache entry and bypasses pipeline creation, preserving the wrong entry points baked into the descriptor.
Impact
This is deterministic WebGPU rendering integrity failure. Valid custom shaders can render with another program's vertex and fragment entry points based solely on creation order. The result can be incorrect geometry, colors, clipping, or blank output across every draw using the aliased cache entry until renderer/cache recreation.
Environment
- PixiJS
devcommit:27071aa0096d8749bfdb189857c58178c30cd153 - npm package:
[email protected] - Browser: headed Camoufox / Firefox
- OS: Linux x86_64
Duplicate search
I searched open and closed issues/PRs for GpuProgram entry-point collisions, pipeline-cache wrong entry points, _layoutKey concatenation, and entry-point cache keys. I found no matching issue. #12213/#12235 concern WebGL shader-name preprocessing and program cleanup, not WebGPU tuple serialization.
If this fits the bounty program, please consider assigning a bounty label and amount before implementation work begins.
Source: pixijs/pixijs