[docs] textures: Writing arrays of images to a 3D texture crashes

Open Beginner friendly
#2,662 4 comments 1 reaction 0 assignees View on GitHub

@reczkok is already working on this.

Since Jun 22, 2026.

  • #2641 by @reczkok — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript
Domain
documentation

Research direction

Start with the “Writing arrays of images” section linked in the issue and compare its 3D texture example with the stated WebGPU restriction. Update the example to use a 2D-array texture or add a note that image sources cannot be written to 3D textures. Done means the documentation no longer presents the crashing example as valid.

Written by the indexing model from the issue text.

Description

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]); // ↓
Image

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
Dominant language
TypeScript
Stars
3.2k
Forks
123
Avg merge
3d 5h
Merged PRs (30d)
34

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from software-mansion/TypeGPU

All issues in software-mansion/TypeGPU

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.