Frames in flight and round-robined resources

107 views
Skip to first unread message

Joyos

unread,
Mar 31, 2023, 7:58:51 AM3/31/23
to Dawn Graphics
Hi,
I am writing a renderer in WebGPU using c++ and Emscripten to convert this to WASM. I read the WebGPU best practices for buffer uploads and it suggests always using Queue::WriteBuffer when using WASM. 

My question is whether or not dawn or other implementations do implicit resource management with WriteBuffer to make multiple frames-in-flight possible. If not, is it (despite using WASM) better to set up a frames-in-flight resource management system and manually upload data to the GPU using a staging buffer and so on?

Corentin Wallez

unread,
Apr 3, 2023, 3:34:29 AM4/3/23
to Joyos, Dawn Graphics
Hey Joyos,

Dawn and other implementations will do the implicit resource management in WriteBuffer() to keep frames in flight going and not introduce GPU->CPU sync points. In Dawn this is done with a ring staging buffer that stores the data for the WriteBuffer/Texture until the underlying copyBufferToBuffer or copyBufferToTexture calls are finished executing. In general WebGPU tries hard to prevent any kind of use-after-free of pointers or resources, the only case in the API is if you access the mapping for an unmapped or destroyed buffer.

Cheers,

Corentin

--
You received this message because you are subscribed to the Google Groups "Dawn Graphics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dawn-graphic...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dawn-graphics/eb04cba1-0ca5-491d-974c-6d50b241e756n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages