Updating attributes on BufferGeometry for WebGPU (original) (raw)

I maintain a MSDF text fork that is updated for WebGPU. And discovered the geometry attributes weren’t updating on text changes. I was resetting buffers on text changes. its ok on WebGLRenderer but not WebGPU / WebGLBackend.

Setting a large enough buffer initially

Modifying the attribute arrays directly

https://github.com/danrossi/three-bmfont-text/blob/dde1a7b801bf7acb2d08ef6f09f4d7b3549fe0bc/src/layout/TextLayout.js#L8
https://github.com/danrossi/three-bmfont-text/blob/dde1a7b801bf7acb2d08ef6f09f4d7b3549fe0bc/src/layout/Vertices.js#L66

Then setting the ranges

Seems to work thankfully.