diff options
author | 2022-03-17 00:41:43 -0300 | |
---|---|---|
committer | 2022-04-26 18:58:48 -0300 | |
commit | 2b4d8a7b2653f51ae83009257c4ec1dc4201d5ff (patch) | |
tree | 176e3697beb672e94429c4c6228178ae395c7c20 | |
parent | 83fec2f5f6231f3871ecfccf594a555253f8286c (diff) | |
download | iced-2b4d8a7b2653f51ae83009257c4ec1dc4201d5ff.tar.gz iced-2b4d8a7b2653f51ae83009257c4ec1dc4201d5ff.tar.bz2 iced-2b4d8a7b2653f51ae83009257c4ec1dc4201d5ff.zip |
Implement `GraphicsInformation` for `iced_glow`
-rw-r--r-- | glow/src/window/compositor.rs | 9 | ||||
-rw-r--r-- | graphics/src/window/gl_compositor.rs | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/glow/src/window/compositor.rs b/glow/src/window/compositor.rs index d1896a97..f2740f6c 100644 --- a/glow/src/window/compositor.rs +++ b/glow/src/window/compositor.rs @@ -67,6 +67,15 @@ impl iced_graphics::window::GLCompositor for Compositor { } } + fn get_information(&self) -> iced_graphics::window::GraphicsInformation { + let adapter = unsafe { self.gl.get_parameter_string(glow::RENDERER) }; + + iced_graphics::window::GraphicsInformation { + backend: format!("{:?}", self.gl.version()), + adapter, + } + } + fn present<T: AsRef<str>>( &mut self, renderer: &mut Self::Renderer, diff --git a/graphics/src/window/gl_compositor.rs b/graphics/src/window/gl_compositor.rs index b1b995f1..23c6d3f8 100644 --- a/graphics/src/window/gl_compositor.rs +++ b/graphics/src/window/gl_compositor.rs @@ -1,3 +1,4 @@ +use crate::window::GraphicsInformation; use crate::{Color, Error, Size, Viewport}; use core::ffi::c_void; @@ -48,6 +49,9 @@ pub trait GLCompositor: Sized { /// Resizes the viewport of the [`GLCompositor`]. fn resize_viewport(&mut self, physical_size: Size<u32>); + /// Returns [`GraphicsInformation`] used by this [`Compositor`]. + fn get_information(&self) -> GraphicsInformation; + /// Presents the primitives of the [`Renderer`] to the next frame of the /// [`GLCompositor`]. /// |