Implement GraphicsInformation for iced_wgpu
This commit is contained in:
parent
e23e4b8db2
commit
83fec2f5f6
2 changed files with 14 additions and 0 deletions
|
|
@ -38,6 +38,9 @@ pub trait Compositor: Sized {
|
||||||
height: u32,
|
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`].
|
/// Presents the [`Renderer`] primitives to the next frame of the given [`Surface`].
|
||||||
///
|
///
|
||||||
/// [`SwapChain`]: Self::SwapChain
|
/// [`SwapChain`]: Self::SwapChain
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ use raw_window_handle::HasRawWindowHandle;
|
||||||
pub struct Compositor {
|
pub struct Compositor {
|
||||||
settings: Settings,
|
settings: Settings,
|
||||||
instance: wgpu::Instance,
|
instance: wgpu::Instance,
|
||||||
|
adapter: wgpu::Adapter,
|
||||||
device: wgpu::Device,
|
device: wgpu::Device,
|
||||||
queue: wgpu::Queue,
|
queue: wgpu::Queue,
|
||||||
staging_belt: wgpu::util::StagingBelt,
|
staging_belt: wgpu::util::StagingBelt,
|
||||||
|
|
@ -93,6 +94,7 @@ impl Compositor {
|
||||||
Some(Compositor {
|
Some(Compositor {
|
||||||
instance,
|
instance,
|
||||||
settings,
|
settings,
|
||||||
|
adapter,
|
||||||
device,
|
device,
|
||||||
queue,
|
queue,
|
||||||
staging_belt,
|
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>>(
|
fn present<T: AsRef<str>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
renderer: &mut Self::Renderer,
|
renderer: &mut Self::Renderer,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue