{"record":{"id":"4338816931ca284e","repo":"mrdoob/three.js","slug":"three-webgpuutils-unsupported-output-buffer-type","errorCode":null,"errorMessage":"THREE.WebGPUUtils: Unsupported output buffer type.","messagePattern":"THREE\\.WebGPUUtils: Unsupported output buffer type\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/renderers/webgpu/utils/WebGPUUtils.js","lineNumber":290,"sourceCode":"\t\t\tif ( this._preferredCanvasFormat === null ) {\n\n\t\t\t\tthis._preferredCanvasFormat = navigator.gpu.getPreferredCanvasFormat();\n\n\t\t\t}\n\n\t\t\treturn this._preferredCanvasFormat;\n\n\t\t} else if ( bufferType === UnsignedByteType ) {\n\n\t\t\treturn GPUTextureFormat.BGRA8Unorm;\n\n\t\t} else if ( bufferType === HalfFloatType ) {\n\n\t\t\treturn GPUTextureFormat.RGBA16Float;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.WebGPUUtils: Unsupported output buffer type.' );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Submits a single GPU command to the device queue using a shared, module-scoped\n * array to avoid per-call array allocations.\n *\n * @private\n * @param {GPUDevice} device - The GPU device.\n * @param {GPUCommandBuffer} command - The command buffer to submit.\n */\nexport function submit( device, command ) {\n\n\t_commandList[ 0 ] = command;","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/mrdoob/three.js/blob/da05705fa31f02710c19772a2aa70c7454807f0c/src/renderers/webgpu/utils/WebGPUUtils.js#L272-L308","documentation":"Thrown by WebGPUUtils.getPreferredCanvasFormat when the renderer's configured outputType is a value other than undefined, UnsignedByteType, or HalfFloatType. outputType selects the GPUTextureFormat of the canvas context configuration: undefined falls back to navigator.gpu.getPreferredCanvasFormat(), UnsignedByteType maps to BGRA8Unorm, and HalfFloatType maps to RGBA16Float. These are the only canvas context formats that round-trip cleanly through a WebGPU swap chain on every device, so any other THREE texture-type constant is rejected at format selection time.","triggerScenarios":"Constructing new THREE.WebGPURenderer({ outputType: <X> }) where X is any constant other than THREE.UnsignedByteType or THREE.HalfFloatType. Common wrong values: THREE.FloatType (full 32-bit float canvas is not a valid WebGPU context format), THREE.HalfFloatType vs the deprecated/renamed constant, a raw numeric literal, or a string. Also calling backend.utils.getPreferredCanvasFormat() after mutating backend.parameters.outputType to an unsupported value.","commonSituations":"Porting a WebGLRenderer configuration that used a 32-bit float output for HDR and assuming WebGPU accepts the same. Confusing outputType with outputBufferType (which defaults to HalfFloatType and has a different valid set). Passing a color-space or pixel-format constant (e.g. RGBAFormat) instead of a texture-type constant. Version changes where a previously-permissive value is now validated.","solutions":["Omit outputType entirely to let the renderer use navigator.gpu.getPreferredCanvasFormat() (recommended default).","Set outputType: THREE.UnsignedByteType for 8-bit-per-channel output (lowest bandwidth, lower quality).","Set outputType: THREE.HalfFloatType for HDR 16-bit float output (recommended for quality).","Audit the config object for any constant other than the two above (especially THREE.FloatType) and remove or replace it."],"exampleFix":"// before: 32-bit float canvas is not a valid WebGPU swap-chain format\nconst renderer = new THREE.WebGPURenderer({ outputType: THREE.FloatType }); // throws\n\n// after: use a supported canvas output type, or omit it\nconst renderer = new THREE.WebGPURenderer({ outputType: THREE.HalfFloatType });","handlingStrategy":"validation","validationCode":"import { UnsignedByteType, HalfFloatType } from 'three';\n\nconst SUPPORTED_OUTPUT_TYPES = new Set( [ undefined, UnsignedByteType, HalfFloatType ] );\n\nfunction resolveOutputType( outputType ) {\n  if ( ! SUPPORTED_OUTPUT_TYPES.has( outputType ) ) {\n    throw new Error(\n      `outputType must be undefined, THREE.UnsignedByteType, or THREE.HalfFloatType (got ${ outputType })`\n    );\n  }\n  return outputType;\n}\n\nconst renderer = new THREE.WebGPURenderer( { outputType: resolveOutputType( config.outputType ) } );","typeGuard":"import { UnsignedByteType, HalfFloatType } from 'three';\n\nfunction isSupportedOutputType( value ) {\n  return value === undefined || value === UnsignedByteType || value === HalfFloatType;\n}","tryCatchPattern":null,"preventionTips":["Omit outputType to use the device's preferred canvas format (safest default).","Allow only THREE.UnsignedByteType or THREE.HalfFloatType in any UI / config schema that feeds the renderer.","Do not confuse outputType (canvas swap-chain format) with outputBufferType (intermediate buffer type); their valid sets differ.","Never pass THREE.FloatType or color-format constants (e.g. RGBAFormat) as outputType."],"tags":["webgpu","canvas","output-format","configuration","renderer-init"],"backgroundTag":null,"analyzedSha":"da05705fa31f02710c19772a2aa70c7454807f0c","analyzedAt":"2026-08-12T22:51:37.160Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}