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

[PoC] Adapt example_glfw_wgpu to wgpu-native #7523

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

eliemichel
Copy link
Contributor

@eliemichel eliemichel commented Apr 22, 2024

Context: This PoC comes as a complement to a remark in #7435.

Problems:

  • The current version of example_glfw_wgpu is 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:

  1. 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)
  2. Replace FetchWgpuNative.cmake by e.g., the webgpu.cmake file 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).
  3. Tell people to make sure that if they provide a WebGPU implem themselves they should take care of defining either WEBGPU_BACKEND_WGPU or WEBGPU_BACKEND_DAWN themselves 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.

ocornut pushed a commit that referenced this pull request Sep 16, 2024
@ocornut
Copy link
Owner

ocornut commented Sep 16, 2024

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!

@eliemichel
Copy link
Contributor Author

eliemichel commented Sep 17, 2024

Will do! Thanks for adding these defines.

@eliemichel
Copy link
Contributor Author

I haven't forgotten this, only wgpu-native and Dawn have been particularly desynchronized lately; working upstream on bringing missing bits to uniformization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants