use nix::libc::c_void;
use super::{PixelFormat, SwapBuffersError};
#[allow(clippy::all, rust_2018_idioms, missing_docs)]
pub(crate) mod ffi {
include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs"));
}
pub use self::ffi::Gles2;
pub trait GLGraphicsBackend {
fn swap_buffers(&self) -> Result<(), SwapBuffersError>;
unsafe fn get_proc_address(&self, symbol: &str) -> *const c_void;
fn get_framebuffer_dimensions(&self) -> (u32, u32);
fn is_current(&self) -> bool;
unsafe fn make_current(&self) -> Result<(), SwapBuffersError>;
fn get_pixel_format(&self) -> PixelFormat;
}
pub fn load_raw_gl<B: GLGraphicsBackend>(backend: &B) -> Gles2 {
Gles2::load_with(|s| unsafe { backend.get_proc_address(s) as *const _ })
}