-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TSL: Introduce attributeArray
and instancedArray
#29881
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
This is a great encapsulation of the existing storage buffer functionality. Maybe you're still planning on adding this, but would users still have the ability to specify their storage node as an atomic? |
The PR does not remove the functionality of |
I'm thinking about renaming |
In that case I vote for |
array
and instancedArray
attributeArray
and instancedArray
// The Pixel Buffer Object (PBO) is required to get the GPU computed data to the CPU in the WebGL2 fallback. | ||
// As used in `renderer.getArrayBufferAsync( waveArray.value )`. | ||
|
||
waveNode.setPBO( true ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sunag The example throws a runtime error right now since setPBO()
does not exist:
Uncaught (in promise) TypeError: waveNode.setPBO is not a function
at init (webgpu_compute_audio.html:107:14)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented out the line for now: #29972
The effect in WebGL 2 does not sound correct though.
@@ -113,6 +113,7 @@ const exceptionList = [ | |||
// Awaiting for WebGL backend support | |||
'webgpu_clearcoat', | |||
'webgpu_compute_audio', | |||
"webgpu_compute_birds", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems it was necessary to comment out the example because the WebGL 2 version is broken with this PR. The following WebGL warning occurs:
WebGL warning: drawArraysInstanced: Vertex fetch requires 147456, but attribs only supply 16384.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea was to release another PR after this for deprecating storageObject()
, I hope to do it this week. The fallback was working but with differences even before the PR, as you can see in the image, after a few seconds in the WebGL2 version the birds are concentrated in the center, in the WebGPU version they spread.
Description
Node allows the addition of anonymous attributes, so we don't need to link it to geometry for different effects. This also allows us to simplify the code for whoever is creating their shaders, making the process much simpler, closer to what would we do in conventional (non-gpu) JS code.
I made a revision so that
toReadOnly()
can be automatically applied to WebGPU if it is not in the compute shader, simplifying the process.Common usage would be
attributeArray( count|array, type )
orinstancedArray( count|array, type )
can be seen in the example below.webgpu_compute_birds
exampleNew approach
Previous approach