mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
Make wgpu the default renderer for eframe and egui.rs (#7615)
* Closes https://github.com/emilk/egui/issues/5889 See the above issue for motivation. To use glow instead, disable the default features of `eframe` and opt-in to `glow`. This also changes egui.rs to use wgpu, which means WebGPU when available, and WebGL otherwise
This commit is contained in:
@@ -471,6 +471,10 @@ impl Default for NativeOptions {
|
||||
/// Options when using `eframe` in a web page.
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
pub struct WebOptions {
|
||||
/// What rendering backend to use.
|
||||
#[cfg(any(feature = "glow", feature = "wgpu_no_default_features"))]
|
||||
pub renderer: Renderer,
|
||||
|
||||
/// Sets the number of bits in the depth buffer.
|
||||
///
|
||||
/// `egui` doesn't need the depth buffer, so the default value is 0.
|
||||
@@ -519,6 +523,9 @@ pub struct WebOptions {
|
||||
impl Default for WebOptions {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
#[cfg(any(feature = "glow", feature = "wgpu_no_default_features"))]
|
||||
renderer: Renderer::default(),
|
||||
|
||||
depth_buffer: 0,
|
||||
|
||||
#[cfg(feature = "glow")]
|
||||
@@ -592,8 +599,8 @@ impl Default for Renderer {
|
||||
#[cfg(feature = "wgpu_no_default_features")]
|
||||
return Self::Wgpu;
|
||||
|
||||
// By default, only the `glow` feature is enabled, so if the user added `wgpu` to the feature list
|
||||
// they probably wanted to use wgpu:
|
||||
// It's weird that the user has enabled both glow and wgpu,
|
||||
// but let's pick the better of the two (wgpu):
|
||||
#[cfg(feature = "glow")]
|
||||
#[cfg(feature = "wgpu_no_default_features")]
|
||||
return Self::Wgpu;
|
||||
|
||||
Reference in New Issue
Block a user