#12241·pixijs

WebGPU attribute-layout cache aliases valid programs across ID groups

Author: mf3493297-pngCreated Sep 27, 2026Updated Sep 27, 2026

WebGPU attribute-layout cache aliases valid programs across ID groups

Current behavior

Two valid WebGPU programs used with the same geometry can receive the same attribute-location key even though their layouts differ:

  1. A procedural program has no vertex attributes.
  2. A second program uses aPosition at shader location 0.

When pipeline creation processes them in that order, the second program reuses the first program's cached empty vertex-buffer layout and empty buffer-binding map. Its required vertex buffer is therefore omitted.

Expected behavior

Distinct attribute-location signatures must receive distinct IDs and cache entries. The aPosition program should receive one vertex-buffer layout and bind the aPosition buffer.

Public runnable reproduction

Run:

bash
npm ci
npm start

Open http://127.0.0.1:4173/webgpu-cache-key-collision/ in Firefox. It prints:

REPRODUCED: {"proceduralProgramKey":1,"positionProgramKey":1,"proceduralLayouts":[],"positionLayouts":[],"positionNames":{},"sameLayouts":true}

Verified in headed Camoufox with no page errors.

Neighboring controls

  • The procedural program correctly produces an empty layout.
  • In isolation, the location-0 program produces a layout containing aPosition.
  • Processing the procedural program first causes the location-0 program to reuse the exact same empty layout object.
  • A location-1 signature receives a distinct ID, showing the collision is specifically the first per-group ID aliasing an existing global string ID.

Root cause

createIdFromString() stores IDs by value globally but increments counters by groupId:

typescript
let id = idHash[value];
if (id === undefined)
{
    idHash[value] = id = idCounts[groupId]++;
}

emptyOverrides interns the empty string in the shader-overrides group. An empty attribute signature later reuses that global ID, without advancing the programAttributes counter. The next new programAttributes value ("0") is then also allocated ID 1.

PipelineSystem._createVertexBufferLayouts() keys its cache from that attribute-location ID. The empty program stores []; the aPosition@0 program receives the same key and returns the cached empty layout. getBufferNamesToBind() consequently returns no buffer names.

Impact

This is order-dependent WebGPU rendering corruption. A valid procedural shader can poison the cache entry later used by a valid vertex-input shader on the same geometry layout. The affected draw omits required vertex buffers, producing WebGPU validation failure or blank/incorrect rendering until renderer/cache recreation.

Environment

  • PixiJS dev commit: 27071aa0096d8749bfdb189857c58178c30cd153
  • npm package: [email protected]
  • Browser: headed Camoufox / Firefox
  • OS: Linux x86_64

Duplicate search

I searched open and closed issues/PRs for createIdFromString, programAttributes, _attributeLocationsKey, _bindingNamesCache, _bufferLayoutsCache, WebGPU location-0 cache collisions, and shader identity collisions. #12213/#12235 concern WebGL program identity after shader-name preprocessing. #12201 concerns destruction of shared cached GpuProgram instances. Neither shares this root cause or cache key.

If this fits the bounty program, please consider assigning a bounty label and amount before implementation work begins.