diff options
author | 2022-03-17 00:34:42 -0300 | |
---|---|---|
committer | 2022-04-26 18:58:19 -0300 | |
commit | 83fec2f5f6231f3871ecfccf594a555253f8286c (patch) | |
tree | 995627648d42afd99f0f64bf592d088a39cfbc91 | |
parent | e23e4b8db20f3910bb6617a6931c9a8906791f8e (diff) | |
download | iced-83fec2f5f6231f3871ecfccf594a555253f8286c.tar.gz iced-83fec2f5f6231f3871ecfccf594a555253f8286c.tar.bz2 iced-83fec2f5f6231f3871ecfccf594a555253f8286c.zip |
Implement `GraphicsInformation` for `iced_wgpu`
-rw-r--r-- | graphics/src/window/compositor.rs | 3 | ||||
-rw-r--r-- | wgpu/src/window/compositor.rs | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/graphics/src/window/compositor.rs b/graphics/src/window/compositor.rs index 5987b118..035101c9 100644 --- a/graphics/src/window/compositor.rs +++ b/graphics/src/window/compositor.rs @@ -38,6 +38,9 @@ pub trait Compositor: Sized { height: u32, ); + /// Returns [`GraphicsInformation`] used by this [`Compositor`]. + fn get_information(&self) -> GraphicsInformation; + /// Presents the [`Renderer`] primitives to the next frame of the given [`Surface`]. /// /// [`SwapChain`]: Self::SwapChain diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs index ca0ce51b..e283c1e2 100644 --- a/wgpu/src/window/compositor.rs +++ b/wgpu/src/window/compositor.rs @@ -9,6 +9,7 @@ use raw_window_handle::HasRawWindowHandle; pub struct Compositor { settings: Settings, instance: wgpu::Instance, + adapter: wgpu::Adapter, device: wgpu::Device, queue: wgpu::Queue, staging_belt: wgpu::util::StagingBelt, @@ -93,6 +94,7 @@ impl Compositor { Some(Compositor { instance, settings, + adapter, device, queue, staging_belt, @@ -155,6 +157,15 @@ impl iced_graphics::window::Compositor for Compositor { ); } + fn get_information(&self) -> iced_graphics::window::GraphicsInformation { + let information = self.adapter.get_info(); + + iced_graphics::window::GraphicsInformation { + adapter: information.name, + backend: format!("{:?}", information.backend), + } + } + fn present<T: AsRef<str>>( &mut self, renderer: &mut Self::Renderer, |