1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 21:00:03 -04:00

eframe: add feature wgpu_no_default_features (#7700)

* Part of https://github.com/emilk/egui/issues/5889
* Closes https://github.com/emilk/egui/issues/7106

This changes the `eframe/wgpu` feature to also enable all the `default`
features of `wgpu` and `egui-wgpu`. This makes switching `eframe`
backend from `glow` to `wgpu` a lot easier.

To get the old behavior (depend on `wgpu` but you must opt-in to all its
features), use the new `wgpu_no_default_features` feature.
This commit is contained in:
Emil Ernerfeldt
2025-11-12 10:51:38 +01:00
committed by GitHub
parent 1af5d1d37e
commit df6f35d568
10 changed files with 77 additions and 75 deletions

View File

@@ -179,7 +179,9 @@ impl EpiIntegration {
#[cfg(feature = "glow")] glow_register_native_texture: Option<
Box<dyn FnMut(glow::Texture) -> egui::TextureId>,
>,
#[cfg(feature = "wgpu")] wgpu_render_state: Option<egui_wgpu::RenderState>,
#[cfg(feature = "wgpu_no_default_features")] wgpu_render_state: Option<
egui_wgpu::RenderState,
>,
) -> Self {
let frame = epi::Frame {
info: epi::IntegrationInfo { cpu_usage: None },
@@ -188,7 +190,7 @@ impl EpiIntegration {
gl,
#[cfg(feature = "glow")]
glow_register_native_texture,
#[cfg(feature = "wgpu")]
#[cfg(feature = "wgpu_no_default_features")]
wgpu_render_state,
raw_display_handle: window.display_handle().map(|h| h.as_raw()),
raw_window_handle: window.window_handle().map(|h| h.as_raw()),

View File

@@ -239,7 +239,7 @@ impl<'app> GlowWinitApp<'app> {
let painter = painter.clone();
move |native| painter.borrow_mut().register_native_texture(native)
})),
#[cfg(feature = "wgpu")]
#[cfg(feature = "wgpu_no_default_features")]
None,
);
@@ -301,7 +301,7 @@ impl<'app> GlowWinitApp<'app> {
storage: integration.frame.storage(),
gl: Some(gl),
get_proc_address: Some(&get_proc_address),
#[cfg(feature = "wgpu")]
#[cfg(feature = "wgpu_no_default_features")]
wgpu_render_state: None,
raw_display_handle: window.display_handle().map(|h| h.as_raw()),
raw_window_handle: window.window_handle().map(|h| h.as_raw()),

View File

@@ -12,5 +12,5 @@ pub(crate) mod winit_integration;
#[cfg(feature = "glow")]
mod glow_integration;
#[cfg(feature = "wgpu")]
#[cfg(feature = "wgpu_no_default_features")]
mod wgpu_integration;

View File

@@ -381,7 +381,7 @@ pub fn create_glow<'a>(
// ----------------------------------------------------------------------------
#[cfg(feature = "wgpu")]
#[cfg(feature = "wgpu_no_default_features")]
pub fn run_wgpu(
app_name: &str,
mut native_options: epi::NativeOptions,
@@ -404,7 +404,7 @@ pub fn run_wgpu(
run_and_exit(event_loop, wgpu_eframe)
}
#[cfg(feature = "wgpu")]
#[cfg(feature = "wgpu_no_default_features")]
pub fn create_wgpu<'a>(
app_name: &str,
native_options: epi::NativeOptions,