1#![allow(non_snake_case)]
6
7#[macro_use]
8extern crate shared_library;
9
10use std::os::raw::{
11 c_char,
12 c_int,
13 c_uchar,
14 c_uint,
15 c_void,
16};
17
18
19#[cfg(target_os="macos")]
24const LIB_NAME: &'static str = "libOSMesa.dylib";
25
26#[cfg(not(target_os="macos"))]
27const LIB_NAME: &'static str = "libOSMesa.so";
28
29shared_library!(OsMesa, LIB_NAME,
30 pub fn OSMesaColorClamp (enable: c_uchar),
31 pub fn OSMesaCreateContext (format: c_uint, sharelist: OSMesaContext) -> OSMesaContext,
32 pub fn OSMesaCreateContextExt (format: c_uint, depthBits: c_int, stencilBits: c_int, accumBits: c_int, sharelist: OSMesaContext) -> OSMesaContext,
33 pub fn OSMesaCreateContextAttribs(attribList: *const c_int, sharelist: OSMesaContext) -> OSMesaContext,
34 pub fn OSMesaDestroyContext (ctx: OSMesaContext),
35 pub fn OSMesaGetColorBuffer (c: OSMesaContext, width: *mut c_int, height: *mut c_int, format: *mut c_int, buffer: *mut *mut c_void) -> c_uchar,
36 pub fn OSMesaGetCurrentContext () -> OSMesaContext,
37 pub fn OSMesaGetDepthBuffer (c: OSMesaContext, width: *mut c_int, height: *mut c_int, bytesPerValue: *mut c_int, buffer: *mut *mut c_void) -> c_uchar,
38 pub fn OSMesaGetIntegerv (pname: c_int, value: *mut c_int),
39 pub fn OSMesaGetProcAddress (funcName: *const c_char) -> OSMESAproc,
40 pub fn OSMesaMakeCurrent (ctx: OSMesaContext, buffer: *mut c_void, _type: c_uint, width: c_int, height: c_int) -> c_uchar,
41 pub fn OSMesaPixelStore (pname: c_int, value: c_int),
42);
43
44
45#[repr(C)] pub struct osmesa_context;
52
53pub type OSMesaContext = *mut osmesa_context;
55pub type OSMESAproc = Option<unsafe extern "C" fn ()>;
56
57
58pub const OSMESA_BGRA: c_uint = 0x0001;
65pub const OSMESA_ARGB: c_uint = 0x0002;
66pub const OSMESA_BGR: c_uint = 0x0004;
67pub const OSMESA_RGB_565: c_uint = 0x0005;
68pub const OSMESA_COLOR_INDEX: c_uint = 0x1900;
69pub const OSMESA_RGB: c_uint = 0x1907;
70pub const OSMESA_RGBA: c_uint = 0x1908;
71
72pub const OSMESA_WIDTH: c_int = 0x0020;
74pub const OSMESA_HEIGHT: c_int = 0x0021;
75pub const OSMESA_FORMAT: c_int = 0x0022;
76pub const OSMESA_TYPE: c_int = 0x0023;
77pub const OSMESA_MAX_WIDTH: c_int = 0x0024;
78pub const OSMESA_MAX_HEIGHT: c_int = 0x0025;
79
80pub const OSMESA_ROW_LENGTH: c_int = 0x0010;
82pub const OSMESA_Y_UP: c_int = 0x0011;
83
84pub const OSMESA_DEPTH_BITS: c_int = 0x30;
86pub const OSMESA_STENCIL_BITS: c_int = 0x31;
87pub const OSMESA_ACCUM_BITS: c_int = 0x32;
88pub const OSMESA_PROFILE: c_int = 0x33;
89pub const OSMESA_CORE_PROFILE: c_int = 0x34;
90pub const OSMESA_COMPAT_PROFILE: c_int = 0x35;
91pub const OSMESA_CONTEXT_MAJOR_VERSION: c_int = 0x36;
92pub const OSMESA_CONTEXT_MINOR_VERSION: c_int = 0x37;