diff options
author | tomaka <pierre.krieger1708@gmail.com> | 2014-10-09 20:04:02 +0200 |
---|---|---|
committer | tomaka <pierre.krieger1708@gmail.com> | 2014-10-09 20:04:02 +0200 |
commit | 093c188b114d879543b98f60b6e9a3489d9cf70f (patch) | |
tree | 4a788e43172cd968c2a2cd1bd7d3102ea6937c80 /src/x11/ffi.rs | |
parent | cfb0cb70013772492c1930ced62f48aa6cb372ff (diff) | |
parent | e565bfeb1372b885f8cced6a42596b731cb382b2 (diff) | |
download | glutin-093c188b114d879543b98f60b6e9a3489d9cf70f.tar.gz glutin-093c188b114d879543b98f60b6e9a3489d9cf70f.zip |
Merge pull request #44 from tomaka/headless-rendering
Implement headless rendering
Diffstat (limited to 'src/x11/ffi.rs')
-rw-r--r-- | src/x11/ffi.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/x11/ffi.rs b/src/x11/ffi.rs index 1f72943..71a6cd9 100644 --- a/src/x11/ffi.rs +++ b/src/x11/ffi.rs @@ -20,6 +20,7 @@ pub type GLXPixmap = XID; pub type GLXWindow = XID; pub type KeyCode = libc::c_ulong; pub type KeySym = XID; +pub type OSMesaContext = *const (); pub type Pixmap = XID; pub type Status = libc::c_int; // TODO: not sure pub type Time = libc::c_ulong; @@ -1356,6 +1357,29 @@ pub struct XF86VidModeModeInfo { private: libc::c_long, } +#[cfg(feature = "headless")] +#[link(name = "OSMesa")] +extern "C" { + pub fn OSMesaCreateContext(format: libc::c_uint, sharelist: OSMesaContext) -> OSMesaContext; + pub fn OSMesaCreateContextExt(format: libc::c_uint, depthBits: libc::c_int, + stencilBits: libc::c_int, accumBits: libc::c_int, sharelist: OSMesaContext) + -> OSMesaContext; + pub fn OSMesaDestroyContext(ctx: OSMesaContext); + pub fn OSMesaMakeCurrent(ctx: OSMesaContext, buffer: *mut libc::c_void, type_: libc::c_uint, + width: libc::c_int, height: libc::c_int) -> libc::c_uchar; + pub fn OSMesaGetCurrentContext() -> OSMesaContext; + pub fn OSMesaPixelStore(pname: libc::c_int, value: libc::c_int); + pub fn OSMesaGetIntegerv(pname: libc::c_int, value: *mut libc::c_int); + pub fn OSMesaGetDepthBuffer(c: OSMesaContext, width: *mut libc::c_int, + height: *mut libc::c_int, bytesPerValue: *mut libc::c_int, + buffer: *mut *mut libc::c_void); + pub fn OSMesaGetColorBuffer(c: OSMesaContext, width: *mut libc::c_int, + height: *mut libc::c_int, format: *mut libc::c_int, buffer: *mut *mut libc::c_void); + pub fn OSMesaGetProcAddress(funcName: *const libc::c_char) -> *const libc::c_void; + pub fn OSMesaColorClamp(enable: libc::c_uchar); +} + +#[cfg(feature = "window")] #[link(name = "GL")] #[link(name = "X11")] #[link(name = "Xxf86vm")] |