Add graphics information to iced_winit
This commit is contained in:
parent
5356bb9bdb
commit
83ab27b5cb
1 changed files with 11 additions and 3 deletions
|
|
@ -167,17 +167,18 @@ where
|
||||||
|
|
||||||
let mut clipboard = Clipboard::connect(&window);
|
let mut clipboard = Clipboard::connect(&window);
|
||||||
|
|
||||||
|
let (compositor, renderer) = C::new(compositor_settings, Some(&window))?;
|
||||||
|
|
||||||
run_command(
|
run_command(
|
||||||
init_command,
|
init_command,
|
||||||
&mut runtime,
|
&mut runtime,
|
||||||
&mut clipboard,
|
&mut clipboard,
|
||||||
&mut proxy,
|
&mut proxy,
|
||||||
&window,
|
&window,
|
||||||
|
&compositor.get_information(),
|
||||||
);
|
);
|
||||||
runtime.track(subscription);
|
runtime.track(subscription);
|
||||||
|
|
||||||
let (compositor, renderer) = C::new(compositor_settings, Some(&window))?;
|
|
||||||
|
|
||||||
let (mut sender, receiver) = mpsc::unbounded();
|
let (mut sender, receiver) = mpsc::unbounded();
|
||||||
|
|
||||||
let mut instance = Box::pin(run_instance::<A, E, C>(
|
let mut instance = Box::pin(run_instance::<A, E, C>(
|
||||||
|
|
@ -262,6 +263,8 @@ async fn run_instance<A, E, C>(
|
||||||
physical_size.height,
|
physical_size.height,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let graphics_info = compositor.get_information();
|
||||||
|
|
||||||
let mut user_interface = ManuallyDrop::new(build_user_interface(
|
let mut user_interface = ManuallyDrop::new(build_user_interface(
|
||||||
&mut application,
|
&mut application,
|
||||||
user_interface::Cache::default(),
|
user_interface::Cache::default(),
|
||||||
|
|
@ -317,6 +320,7 @@ async fn run_instance<A, E, C>(
|
||||||
&mut debug,
|
&mut debug,
|
||||||
&mut messages,
|
&mut messages,
|
||||||
&window,
|
&window,
|
||||||
|
&graphics_info,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Update window
|
// Update window
|
||||||
|
|
@ -516,6 +520,7 @@ pub fn update<A: Application, E: Executor>(
|
||||||
debug: &mut Debug,
|
debug: &mut Debug,
|
||||||
messages: &mut Vec<A::Message>,
|
messages: &mut Vec<A::Message>,
|
||||||
window: &winit::window::Window,
|
window: &winit::window::Window,
|
||||||
|
graphics_info: &window::GraphicsInformation,
|
||||||
) {
|
) {
|
||||||
for message in messages.drain(..) {
|
for message in messages.drain(..) {
|
||||||
debug.log_message(&message);
|
debug.log_message(&message);
|
||||||
|
|
@ -524,7 +529,7 @@ pub fn update<A: Application, E: Executor>(
|
||||||
let command = runtime.enter(|| application.update(message));
|
let command = runtime.enter(|| application.update(message));
|
||||||
debug.update_finished();
|
debug.update_finished();
|
||||||
|
|
||||||
run_command(command, runtime, clipboard, proxy, window);
|
run_command(command, runtime, clipboard, proxy, window, graphics_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
let subscription = application.subscription();
|
let subscription = application.subscription();
|
||||||
|
|
@ -538,6 +543,7 @@ pub fn run_command<Message: 'static + std::fmt::Debug + Send, E: Executor>(
|
||||||
clipboard: &mut Clipboard,
|
clipboard: &mut Clipboard,
|
||||||
proxy: &mut winit::event_loop::EventLoopProxy<Message>,
|
proxy: &mut winit::event_loop::EventLoopProxy<Message>,
|
||||||
window: &winit::window::Window,
|
window: &winit::window::Window,
|
||||||
|
graphics_info: &window::GraphicsInformation,
|
||||||
) {
|
) {
|
||||||
use iced_native::command;
|
use iced_native::command;
|
||||||
use iced_native::system;
|
use iced_native::system;
|
||||||
|
|
@ -591,6 +597,8 @@ pub fn run_command<Message: 'static + std::fmt::Debug + Send, E: Executor>(
|
||||||
cpu_brand: cpu.brand().into(),
|
cpu_brand: cpu.brand().into(),
|
||||||
cpu_cores: system.physical_core_count(),
|
cpu_cores: system.physical_core_count(),
|
||||||
memory_total: system.total_memory(),
|
memory_total: system.total_memory(),
|
||||||
|
graphics_adapter: graphics_info.adapter.clone(),
|
||||||
|
graphics_backend: graphics_info.backend.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
Some(information)
|
Some(information)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue