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

eframe support for wgpu on the web #2107

Merged
merged 23 commits into from
Oct 5, 2022
Merged

eframe support for wgpu on the web #2107

merged 23 commits into from
Oct 5, 2022

Conversation

Wumpf
Copy link
Collaborator

@Wumpf Wumpf commented Oct 4, 2022

Adds a wgpu painter for eframe's web compilation (i.e. targeting wasm).
You can render the demo with it by replacing glow with wgpu in the feature list in build_demo_web.sh. Worked fine for me on manual testing!

Fixes #1755

Remaining things to figure out (likely after this PR):

  • target is currently srgb, this causes blending to be done incorrectly. It seems wgpu doesn't support anything else for webgl canvases right now (why?)
  • associate a depth buffer with the egui-wgpu renderer
  • expose MSAA settings
  • expose limits settings etc.
  • allow targeting WebGPU

@Wumpf
Copy link
Collaborator Author

Wumpf commented Oct 4, 2022

filed wgpu issue for srgb issue gfx-rs/wgpu#3059

@emilk
Copy link
Owner

emilk commented Oct 4, 2022

crates/egui_demo_app/src/apps/custom3d_glow.rs should be made to work before we merge this (or disabled on wasm32+wgpu)

@Wumpf
Copy link
Collaborator Author

Wumpf commented Oct 5, 2022

Fixed!
image

@emilk
Copy link
Owner

emilk commented Oct 5, 2022

I get this warning in Firefox:

WebGL warning: getSyncParameter: ClientWaitSync must return TIMEOUT_EXPIRED until control has returned to the user agent's main loop. (only warns once)

No such warning on chromium.

@emilk
Copy link
Owner

emilk commented Oct 5, 2022

This works great, good job! ⭐

@emilk
Copy link
Owner

emilk commented Oct 5, 2022

The demo app WASM increases in size by a whopping 1.5 MB (4.7MB -> 6.3MB). Not great. wgpu needs to go on a diet!

@Wumpf
Copy link
Collaborator Author

Wumpf commented Oct 5, 2022

I get this warning in Firefox:

WebGL warning: getSyncParameter: ClientWaitSync must return TIMEOUT_EXPIRED until control has returned to the user agent's main loop. (only warns once)

No such warning on chromium.

Saw it as well, filed an issue gfx-rs/wgpu#3064

@emilk
Copy link
Owner

emilk commented Dec 5, 2022

So starting with this, eframe::start_web is now async. This, I believe, makes it incompatible with trunk, which eframe_template is using 😭

I opened this trunk issue: trunk-rs/trunk#466

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

Successfully merging this pull request may close these issues.

egui-wgpu on web
2 participants