{"record":{"id":"4bbab942c68df178","repo":"mrdoob/three.js","slug":"three-webglbackend-unsupported-buffer-data-format","errorCode":null,"errorMessage":"THREE.WebGLBackend: Unsupported buffer data format: ","messagePattern":"THREE\\.WebGLBackend: Unsupported buffer data format: ","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js","lineNumber":159,"sourceCode":"\t\t} else if ( array instanceof Int32Array ) {\n\n\t\t\ttype = gl.INT;\n\n\t\t} else if ( array instanceof Int8Array ) {\n\n\t\t\ttype = gl.BYTE;\n\n\t\t} else if ( array instanceof Uint8Array ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else if ( array instanceof Uint8ClampedArray ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.WebGLBackend: Unsupported buffer data format: ' + array );\n\n\t\t}\n\n\t\tlet attributeData = {\n\t\t\tbufferGPU,\n\t\t\tbufferType,\n\t\t\ttype,\n\t\t\tbyteLength: array.byteLength,\n\t\t\tbytesPerElement: array.BYTES_PER_ELEMENT,\n\t\t\tversion: attribute.version,\n\t\t\tpbo: attribute.pbo,\n\t\t\tisInteger: type === gl.INT || type === gl.UNSIGNED_INT || attribute.gpuType === IntType,\n\t\t\tid: _id ++\n\t\t};\n\n\t\tif ( attribute.isStorageBufferAttribute || attribute.isStorageInstancedBufferAttribute ) {\n\n\t\t\t// create buffer for transform feedback use","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/mrdoob/three.js/blob/da05705fa31f02710c19772a2aa70c7454807f0c/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js#L141-L177","documentation":"Thrown by WebGLAttributeUtils (WebGPU WebGL-fallback backend) when a BufferAttribute's `.array` is not one of the recognized typed-array types. The uploader maps Float32Array, Float16-marked Uint16Array, Uint16Array, Int16Array, Uint32Array, Int32Array, Int8Array, Uint8Array, and Uint8ClampedArray to GL constants; anything else (plain Array, Float64Array, BigInt64Array, DataView) is unsupported because WebGL has no corresponding buffer target type.","triggerScenarios":"Creating `new BufferAttribute(new Array(n), itemSize)`, passing a Float64Array, a BigInt64Array, or a non-typed-array as the attribute's array. Also triggered by a custom BufferAttribute subclass that returns an unsupported array type.","commonSituations":"Loading a plain JS array from JSON and assigning it directly to a BufferAttribute without `new Float32Array(...)`. Using Float64Array for precision then uploading to GPU. Copying example code that built arrays with `.map()` returning a normal Array. Custom geometry generators yielding non-typed arrays.","solutions":["Wrap your data in a typed array matching the GPU type: `new BufferAttribute(new Float32Array(data), itemSize)`.","For integer attributes use the matching Int/Uint typed array (Int32Array, Uint8Array, etc.).","If you need Float64 precision on CPU, downcast to Float32Array before creating the BufferAttribute.","Avoid passing plain `[]`-built arrays; convert with the appropriate typed-array constructor."],"exampleFix":"// before\nconst positions = vertices.map(v => v.x); // plain Array\ngeom.setAttribute('position', new BufferAttribute(positions, 1)); // throws\n\n// after\nconst positions = new Float32Array(vertices.flatMap(v => [v.x, v.y, v.z]));\ngeom.setAttribute('position', new BufferAttribute(positions, 3));","handlingStrategy":"type-guard","validationCode":"const SUPPORTED = [Float32Array, Float16Array, Uint16Array, Int16Array, Uint32Array, Int32Array, Int8Array, Uint8Array, Uint8ClampedArray];\nfunction assertSupportedArray(array) {\n  if (!SUPPORTED.some(T => array instanceof T)) {\n    throw new TypeError('BufferAttribute.array must be a supported typed array');\n  }\n}","typeGuard":"function isSupportedTypedArray(array) {\n  return ArrayBuffer.isView(array) && typeof array.BYTES_PER_ELEMENT === 'number' && !(array instanceof Float64Array) && !(array instanceof BigUint64Array) && !(array instanceof BigInt64Array);\n}","tryCatchPattern":null,"preventionTips":["Always wrap attribute data in a typed array constructor (Float32Array for positions/normals/uvs).","Never assign a plain Array to BufferAttribute.array.","Add a debug assertion in your geometry builder to reject unsupported array types."],"tags":["webgl","buffer-attribute","typed-array","geometry","data-format"],"backgroundTag":null,"analyzedSha":"da05705fa31f02710c19772a2aa70c7454807f0c","analyzedAt":"2026-08-12T22:51:37.160Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}