imgui
imgui copied to clipboard
[PoC] Adapt example_glfw_wgpu to wgpu-native
Context: This PoC comes as a complement to a remark in #7435.
Problems:
- The current version of
example_glfw_wgpuis tied to Dawn implementation for multiple reasons (see this comment). - It is hard at this stage of WebGPU to have a code that is truly implem-agnostic.
This PR shows an alternative version of example_glfw_wgpu that uses wgpu-native, and which is in general closer to what an implem-agnostic version would look like. It uses precompiled binaries, which makes building the example for quick testing much faster than building Dawn.
Receipe to make this implem-agnostic:
- Wait until the next release of emscripten so that they get the new Surface Configuration API (already available in Dawn and wgpu-native), which replaces the deprecated SwapChain API (dropped from the standard ~8 months ago and no longer provided by wgpu-native)
- Replace
FetchWgpuNative.cmakeby e.g., thewebgpu.cmakefile from my WebGPU-distribution repo (I did not want to impose this by default since I'm clearly biased in favor of my tool here -- my ultimate goal is that one day this whole distribution thing will no longer be needed). - Tell people to make sure that if they provide a WebGPU implem themselves they should take care of defining either
WEBGPU_BACKEND_WGPUorWEBGPU_BACKEND_DAWNthemselves as well.
Due to all these reason I suggest not to merge this right away, but keeping the PR as a reference may be useful for the very near future.
Note that as of 1ac162f we have added define to facilitate supporting both Dawn and WGPU in the backends. We could consider making the example itself support those defines. Do you think the PR could be updated accordingly? Thank you!
Will do! Thanks for adding these defines.
I haven't forgotten this, only wgpu-native and Dawn have been particularly desynchronized lately; working upstream on bringing missing bits to uniformization.
This should be all solved by #8381 now.