Skip to content
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

WebGPURenderer: Add support for non-instanced meshes to StorageBuffer #27712

Merged
merged 2 commits into from
Feb 12, 2024

Conversation

RenaudRohlinger
Copy link
Collaborator

@RenaudRohlinger RenaudRohlinger commented Feb 8, 2024

It's currently not possible to use the storage buffers as attribute informations on the vertices for a classic mesh. This PR fix the issue.

Alternative could be to introduce breaking changes and replace everything with StorageInstancedBufferAttribute for the current compute particle demos and use StorageBufferAttribute for classic meshes.

In the WebGL Backend I guess using attributes[ 0 ].isInstancedBufferAttribute should be enough? Not sure of a case where we would use instanced and basic array buffer at the same time in a compute shading.

This contribution is funded by Utsubo

@sunag
Copy link
Collaborator

sunag commented Feb 9, 2024

The alternative StorageInstancedBufferAttribute sounds good to me, seems like one less hack to worry about.

@mrdoob @Mugen87 Do you have any thoughts on this?

@RenaudRohlinger
Copy link
Collaborator Author

Let's give it a try!

@mrdoob
Copy link
Owner

mrdoob commented Feb 9, 2024

Hmm... What's a storage buffer in the context of WebGL?

@RenaudRohlinger
Copy link
Collaborator Author

RenaudRohlinger commented Feb 9, 2024

Hmm... What's a storage buffer in the context of WebGL?

A storage buffer in the context of WebGL is essentially a buffer that is typically utilized to imitate compute shading via a transform feedback program. Specifically, it operates as a dual-buffer system that switches every frame in a ping-pong manner. This setup is used to replicate the functionality of a WebGPU storage_buffer, which provides read_write access.

Basically I wouldn't really look too far as to what its meaning is in the WebGL context since its application here is only to replicate what is normally not doable and just mimic WebGPU behaviors.

@sunag sunag added this to the r162 milestone Feb 9, 2024
@sunag sunag merged commit 28a8dff into mrdoob:dev Feb 12, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants