#12244·pixijs

UniformGroup signature omits array size and reuses an incompatible UBO sync function

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

UniformGroup signature omits array size and reuses an incompatible UBO sync function

Current behavior

UniformGroup signatures include each uniform's name and type, but omit its size. A scalar and an array using the same name/type therefore receive the same signature:

  • uValues: { type: 'f32', size: 1, value: 1 }
  • uValues: { type: 'f32', size: 4, value: [1, 2, 3, 4] }

If the scalar group is processed first, UboSystem caches its scalar layout and sync function. The four-element group reuses that entry. Instead of uploading [1, 2, 3, 4], its buffer becomes [NaN, 0, 0, 0].

Expected behavior

Uniform groups whose array sizes differ must have distinct signatures and cached UBO synchronization functions.

Public runnable reproduction

Run:

bash
npm ci
npm start

Open http://127.0.0.1:4173/ubo-size-signature-collision/?mode=collision in Firefox. It prints:

REPRODUCED: {"mode":"collision","oneSignature":1,"fourSignature":1,"layoutSize":16,"buffer":["NaN",0,0,0]}

The isolated control ?mode=control processes the four-element group first and prints:

CONTROL: {"mode":"control","oneSignature":1,"fourSignature":1,"layoutSize":16,"buffer":[1,2,3,4]}

Both were verified in headed Camoufox with no page errors.

Root cause

UniformGroup builds _signature from only name and type:

typescript
this._signature = createIdFromString(Object.keys(uniforms).map(
    (i) => `${i}-${uniformStructures[i].type}`
).join('-'), 'uniform-group');

UniformData.size is absent. UboSystem then caches layouts and generated sync functions solely by that signature:

typescript
return this._syncFunctionHash[uniformGroup._signature]
    || this._initUniformGroup(uniformGroup);

The scalar-generated sync function treats the array value as a scalar and writes it incorrectly.

Impact

This is deterministic uniform-data corruption across WebGPU and UBO-backed WebGL2 rendering. Creation order between otherwise valid uniform groups can turn array values into NaN/zeros. Shaders using array uniforms can render incorrect transforms, colors, lighting, filters, or no visible output until renderer/cache recreation.

Environment

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

Duplicate search

I searched open and closed issues/PRs for UniformGroup size/signature collisions, UBO array cache collisions, truncated WebGPU uniform arrays, and UBO layout-cache sizing. I found no matching issue. #10599 concerns a different array-of-structs UBO failure and does not describe signature aliasing between supported scalar/array declarations.

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