-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Description
Description
I used to work with WebGLRenderer and often had requirements for custom meshes, such as defining an IconMesh that includes IconGeometry (extending from BufferGeometry) and an IconMaterial. IconGeometry requires an attribute for rendering, and I use geometry.setAttribute('position', new Float32BufferAttribute(array, 3)) to update the attribute.
For example, during initialization, I use geometry.setAttribute('position', new Float32BufferAttribute(array, 3)) with array.length being 1200. Later, I have an update requirement where the array changes and array.length becomes 2400. At this point, I again use geometry.setAttribute('position', new Float32BufferAttribute(array, 3)) to update the attribute. This worked well with WebGLRenderer, but recently when using WebGPURenderer, it results in an error

At this point, I need to call material.needsUpdate = true to update the material for it to take effect. It doesn’t seem reasonable that updating an attribute would require recompiling the material.
I understand that it’s best not to modify the size of the buffer in BufferGeometry, as doing so would likely cause the buffer to be recreated. However, in my use case (based on WebGLRenderer), this hasn’t caused any noticeable performance issues, and being able to reset the size of the attribute is what I want.
Reproduction steps
- init geometry based on WebGPURenderer
- geometry.setAttribute('position', new Float32BufferAttribute(array, 3)),array.length being 1200
- geometry.setAttribute('position', new Float32BufferAttribute(array, 3)),array.length being 2400
Code
geometry.setAttribute('position', new Float32BufferAttribute(array, 3))Live example
empty
Screenshots
No response
Version
170dev
Device
No response
Browser
No response
OS
No response