I am simulating a large particule system.
For this purpose, I have written WebGPU compute shaders as well as instanciation code, which is well contained into a sim class.
I want to pass the output (GPUBuffer) that represent vertices positions to the renderer.
So I would like to create a BABYLON.VertexBuffer that directly use an existing GPUBuffer. Is this possible ?
I would like to keep a clean separation between the simulation code (WebGPU only) and the rendering code (Babylonsjs).
Then you’ll have to copy the output buffer to the vertex buffer of the shader. But I believe you could pass a Float32Array read from your WebGPU buffer to the shader directly. It still counts as a good separation concept to me.
Thanks Roland.
How to pass a GPUBuffer Float32Array to the babylon buffer directly on the GPU (without having the data going to the CPU)?
Should my WebGPU code call GPUCommandEncoder.copyBufferToBuffer(source: GPUBuffer, sourceOffset: number, destination: GPUBuffer, destinationOffset: number, size: number): void to handle the copy directly to the babylon buffer ?
If so, I need to access the underlying GPUBuffer of the Babylon buffer. Is this possible?