Docs
This may be me who hasn't understood yet how it works but it seems that the "Writing arrays of images" docs example doesn't work :
const texture3d = root.createTexture({
size: [256, 256, 3],
format: 'rgba8unorm',
dimension: '3d',
}).$usage('sampled');
texture3d.write([imageBitmap1, imageBitmap2, imageBitmap3]); // ↓
WebGPU's copyExternalImageToTexture (used internally by .write()) only accepts 2D textures as destination — dimension: '3d' is invalid by spec, regardless of usage flags.
Workaround
Drop dimension: '3d'. The default creates a 2D-array texture, which works:
const texture3d = root.createTexture({
size: [256, 256, 3],
format: 'rgba8unorm',
}).$usage('sampled', 'render');
texture3d.write([imageBitmap1, imageBitmap2, imageBitmap3]); // ✅
The docs example should be updated to use a 2D-array, or include a note that dimension: '3d' cannot be written from image sources.
Environment
- TypeGPU
0.11.2
- Arc / macOS
Docs
This may be me who hasn't understood yet how it works but it seems that the "Writing arrays of images" docs example doesn't work :
WebGPU's
copyExternalImageToTexture(used internally by.write()) only accepts 2D textures as destination —dimension: '3d'is invalid by spec, regardless of usage flags.Workaround
Drop
dimension: '3d'. The default creates a 2D-array texture, which works:The docs example should be updated to use a 2D-array, or include a note that
dimension: '3d'cannot be written from image sources.Environment
0.11.2