* eframe::run_native: return errors instead of crashing
* Detect and handle glutin errors
* egui_demo_app: silence wgpu log spam
* Add trace logs for why eframe is shutting down
* Fix: only save App state once on Mac
* Handle Winit failure
* Log where we load app state from
* Don't panic on zero-sized window
* Clamp loaded window size to not be too tiny to see
* Simplify code: more shared code in window_builder
* Improve code readability
* Fix wasm32 build
* fix android
* Update changelog
* basic working wgpu @ webgl on websys
* fix glow compile error
* introduced WebPainter trait, provide wgpu renderstate
* WebPainterWgpu destroy implemented
* make custom3d demo work on wgpu backend
* changelog entry for wgpu support eframe wasm
* remove temporary logging hack
* stop using pollster for web
we're actually not allowed to block - this only worked because wgpu on webgl doesn't actually cause anything blocking. However, when trying webgpu this became an issue
* revert cargo update
* compile error if neither glow nor wgpu features are enabled
* code cleanup
* Error handling
* Update changelog with link
* Make sure --all-features work
* Select best framebuffer format from the available ones
* update to wasm-bindgen 0.2.83
* Fix typo
* Clean up Cargo.toml
* Log about using the wgpu painter
* fixup wgpu labels
* fix custom3d_wgpu_shader ub padding
* remove duplicated uniforms struct in wgsl shader for custom3d
* Update docs: add async/await to the web 'start' function
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* eframe: allow hooking into EventLoop building
This enables native applications to add an `event_loop_builder` callback
to the `NativeOptions` struct that lets them modify the Winit
`EventLoopBuilder` before the final `EventLoop` is built and run.
This makes it practical for applications to change platform
specific config options that Egui doesn't need to be directly aware of.
For example the `android-activity` glue crate that supports writing
Android applications in Rust requires that the Winit event loop be
passed a reference to the `AndroidApp` that is given to the
`android_main` entrypoint for the application.
Since the `AndroidApp` itself is abstracted by Winit then there's no
real need for Egui/EFrame to have a dependency on the `android-activity`
crate just for the sake of associating this state with the event loop.
Addresses: #1951
* eframe: defer graphics state initialization until app Resumed
Conceptually the Winit `Resumed` event signifies that the application is
ready to run and render and since
https://github.com/rust-windowing/winit/pull/2331 all platforms now
consistently emit a Resumed event that can be used to initialize
graphics state for an application.
On Android in particular it's important to wait until the application
has Resumed before initializing graphics state since it won't have an
associated SurfaceView while paused.
Without this change then Android applications are likely to just show
a black screen.
This updates the Wgpu+Winit and Glow+Winit integration for eframe but
it's worth noting that the Glow integration is still not able to fully
support suspend and resume on Android due to limitations with Glutin's
API that mean we can't destroy and create a Window without also
destroying the GL context, and therefore (practically) the entire
application.
There is a plan (and progress on) to improve the Glutin API here:
https://github.com/rust-windowing/glutin/pull/1435 and with that change
it should be an incremental change to enable Android suspend/resume
support with Glow later.
In the mean time the Glow changes keep the implementation consistent
with the wgpu integration and it should now at least be possible to
start an Android application - even though it won't be able to suspend
correctly.
Fixes#1951