Implement GraphicsInformation for iced_glow

This commit is contained in:
Richard 2022-03-17 00:41:43 -03:00
parent 83fec2f5f6
commit 2b4d8a7b26
2 changed files with 13 additions and 0 deletions

View file

@ -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,

View file

@ -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`].
///