use std::fmt;
use std::ops;
use std::rc::Rc;
#[allow(clippy::all)]
mod gl {
include!(concat!(env!("OUT_DIR"), "/opengl-bindings.rs"));
}
pub use gl::*;
mod miru {
include!(concat!(env!("OUT_DIR"), "/miru-pinned-opengl-version.rs"));
}
#[derive(Clone)]
pub struct MiruGl {
inner: Rc<Gl>,
}
impl MiruGl {
#[cfg_attr(tarpaulin, skip)]
pub fn load_with<F>(loadfn: F) -> MiruGl
where
F: FnMut(&'static str) -> *const std::ffi::c_void,
{
MiruGl {
inner: Rc::new(Gl::load_with(loadfn)),
}
}
#[cfg_attr(tarpaulin, skip)]
pub fn version(&self) -> (u8, u8) {
miru::OPENGL_VERSION
}
}
impl fmt::Debug for MiruGl {
#[cfg_attr(tarpaulin, skip)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let (major, minor) = self.version();
write!(
f,
"MiruGl: Shared OpenGL {}.{} (Core Profile) api handle",
major, minor
)
}
}
impl ops::Deref for MiruGl {
type Target = Gl;
#[cfg_attr(tarpaulin, skip)]
fn deref(&self) -> &Self::Target {
&self.inner
}
}