-
-
Notifications
You must be signed in to change notification settings - Fork 36.3k
Open
Labels
TSLThree.js Shading LanguageThree.js Shading Language
Milestone
Description
Description
When using a "storage" node to attach a storage buffer attribute the buffer is automatically converted to a scalar value if the buffer is only a single element long. This breaks shaders that rely on accessing the storage buffer as an array. The resulting shader should respect the user's graph definition rather than transforming it in ways that may break user code.
This has been causing headaches during the path tracer development when a single geometry or material is rendered, for example, so the transform and material buffers are set to a length of 1.
Reproduction steps
- Create a compute kernel with a storage buffer of length 1
- Add a wgslFn node that access the storage buffer
- Run it, see that it breaks because the scalar version of the input is not an array.
- Replace the buffer with one that is longer than length 1
- See that it still does not work because the shader has already been compiled with a scalar.
Code
See fiddle
Live example
https://jsfiddle.net/9dqzj42L/
Screenshots
Version
r183
Device
No response
Browser
No response
OS
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
TSLThree.js Shading LanguageThree.js Shading Language