{"record":{"id":"74f5d0493747d82b","repo":"pixijs/pixijs","slug":"unknown-type-uboelement-data-type","errorCode":null,"errorMessage":"Unknown type ${uboElement.data.type}","messagePattern":"Unknown type (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/rendering/renderers/gl/shader/utils/createUboElementsSTD40.ts","lineNumber":71,"sourceCode":"            data,\n            offset: 0,\n            size: 0,\n        }));\n\n    const chunkSize = 16;\n\n    let size = 0;\n    let offset = 0;\n\n    for (let i = 0; i < uboElements.length; i++)\n    {\n        const uboElement = uboElements[i];\n\n        size = WGSL_TO_STD40_SIZE[uboElement.data.type];\n\n        if (!size)\n        {\n            throw new Error(`Unknown type ${uboElement.data.type}`);\n        }\n\n        if (uboElement.data.size > 1)\n        {\n            size = Math.max(size, chunkSize) * uboElement.data.size;\n        }\n\n        const boundary = size === 12 ? 16 : size;\n\n        uboElement.size = size;\n\n        const curOffset = offset % chunkSize;\n\n        if (curOffset > 0 && chunkSize - curOffset < boundary)\n        {\n            offset += (chunkSize - curOffset) % 16;\n        }\n        else","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/pixijs/pixijs/blob/4b141e3ced7255b39c2114b6bca03421a37b2363/src/rendering/renderers/gl/shader/utils/createUboElementsSTD40.ts#L53-L89","documentation":"Thrown by createUboElementsSTD40() when computing the STD40 packing layout for a uniform buffer object (UBO) and a uniform's WGSL type string is absent from the WGSL_TO_STD40_SIZE table. The table covers f32/i32/u32, their vec2-4 variants, and mat2x2/3x3/4x4. Any other type (e.g. a struct, an array type, a f16, or a custom/typo'd type string) yields size === undefined and is rejected.","triggerScenarios":"Declaring a uniform in a shader whose type is not in the STD40 size map (e.g. arrays of structs, half-precision types, or a malformed type string). Fires when the renderer builds the UBO layout from the program's uniform metadata.","commonSituations":"Custom shaders introducing uniform types the STD40 packer doesn't support (arrays, nested structs, f16). Typos in WGSL type annotations inside uniform data. Library version mismatch where a new type was added to shaders but not to the packer table.","solutions":["Restrict UBO uniforms to the supported primitive/vector/matrix types (f32, i32, u32, vec2/3/4, mat2x2/3x3/4x4).","Decompose unsupported types (structs/arrays) into individual supported uniforms.","If you control the shader compiler, ensure the emitted uniform type string exactly matches a key in WGSL_TO_STD40_SIZE."],"exampleFix":"// before (uniform metadata)\n{ name: 'uLights', type: 'array<vec3<f32>, 8>' } // not in STD40 map\n\n// after\n// flatten to individual supported uniforms or use a fixed set of vec4 entries:\n{ name: 'uLight0', type: 'vec4<f32>' },\n{ name: 'uLight1', type: 'vec4<f32>' } /* ... */","handlingStrategy":"validation","validationCode":"const SUPPORTED_UBO_TYPES = new Set([\n  'f32','i32','u32',\n  'vec2<f32>','vec3<f32>','vec4<f32>',\n  'vec2<i32>','vec3<i32>','vec4<i32>',\n  'vec2<u32>','vec3<u32>','vec4<u32>',\n  'mat2x2<f32>','mat3x3<f32>','mat4x4<f32>',\n]);\nfunction assertUboTypesSupported(uniforms: {type:string}[]): void {\n  for (const u of uniforms) {\n    if (!SUPPORTED_UBO_TYPES.has(u.type)) {\n      throw new Error(`Uniform type '${u.type}' is not supported by the STD40 UBO packer.`);\n    }\n  }\n}","typeGuard":"function isStd40SupportedType(type: string): boolean {\n  return type in WGSL_TO_STD40_SIZE; // import the map or mirror it\n}","tryCatchPattern":null,"preventionTips":["Restrict UBO uniforms to scalar/vector/matrix types the packer knows.","Validate shader uniform metadata at load time, not at draw time.","Keep your shader compiler's emitted types in sync with the STD40 size table."],"tags":["webgl","shader","ubo","std40","uniform-layout"],"backgroundTag":null,"analyzedSha":"4b141e3ced7255b39c2114b6bca03421a37b2363","analyzedAt":"2026-08-12T17:27:29.507Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}