Skip to content

fix(core): Auto-convert uint8 buffers to uint16#2486

Merged
felixpalmer merged 2 commits into9.2-releasefrom
felix/uint8-indexType
Jan 16, 2026
Merged

fix(core): Auto-convert uint8 buffers to uint16#2486
felixpalmer merged 2 commits into9.2-releasefrom
felix/uint8-indexType

Conversation

@felixpalmer
Copy link
Collaborator

Background

WebGPU doesn't support Uint8Array buffers, but the GLTF loader can produce them (as could any app). Many small 3D tiles end up having a Uint8Array index buffer which causes luma to throw an error:

deck: initialization of ScenegraphLayer({id: 'google-3d-tiles-scenegraph-https://tile.googleapis.com/v1/3dtiles/datasets/XXX.glb'}): indices buffer content must be of type uint16 or uint32 Error: indices buffer content must be of type uint16 or uint32
    at WebGLDevice._normalizeBufferProps (device.ts:762:15)

As a result the tile doesn't load and there is a hole in the terrain:

Screenshot 2026-01-14 at 09 11 15

To resolve this, this PR automatically converts uint8 buffers to uint16. Given that the buffers will typically be small, the extra memory isn't significant.

After this PR:

Screenshot 2026-01-14 at 09 11 38

Change List

  • Convert uint8 to uint16 for WebGPU compatibility
  • Test case

@markmasry
Copy link

thanks @felixpalmer, looks really promising. I suspect that this is related to my issue. The problem seems most severe in areas where the ground resolution is low or the tiles would have been simplified a lot (water areas, rural areas, etc..). I'm guessing these areas where there are a lot of simple tiles.

Copy link
Contributor

@charlieforward9 charlieforward9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First time poking around in luma. I appreciate the attention on this issue and exposure to a lower level.

Copy link
Contributor

@chrisgervang chrisgervang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be mentioned in the docs, or are there no consequences to a user?

@felixpalmer
Copy link
Collaborator Author

Does this need to be mentioned in the docs, or are there no consequences to a user?

Done: 068be39

In general I don't expect the user will notice, this is more removing a gotcha

@felixpalmer felixpalmer merged commit 009de43 into 9.2-release Jan 16, 2026
2 checks passed
@felixpalmer felixpalmer deleted the felix/uint8-indexType branch January 16, 2026 09:45
@markmasry
Copy link

This appears to have fixed my issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants