surfman/
lib.rs

1// surfman/surfman/src/lib.rs
2//
3//! Cross-platform GPU device and surface management.
4//!
5//! You can use this crate to multithread a graphics application so that rendering happens on
6//! multiple threads, sharing textures among them in the most efficient manner. It may also be
7//! useful as a lightweight framework for *just* initializing rendering in native applications.
8//! This is in contrast to crates like SDL, GLFW, winit, and Glutin, all of which have a broader
9//! focus in that they manage windowing and the event loop as well.
10
11#![warn(missing_docs)]
12
13#[macro_use]
14extern crate bitflags;
15#[allow(unused_imports)]
16#[macro_use]
17extern crate log;
18
19pub mod platform;
20pub use platform::default::connection::{Connection, NativeConnection};
21pub use platform::default::context::{Context, ContextDescriptor, NativeContext};
22pub use platform::default::device::{Adapter, Device, NativeDevice};
23pub use platform::default::surface::{NativeWidget, Surface, SurfaceTexture};
24
25// TODO(pcwalton): Fill this in with other OS's.
26#[cfg(target_os = "macos")]
27pub use platform::system::connection::Connection as SystemConnection;
28#[cfg(target_os = "macos")]
29pub use platform::system::device::{Adapter as SystemAdapter, Device as SystemDevice};
30#[cfg(target_os = "macos")]
31pub use platform::system::surface::Surface as SystemSurface;
32
33#[cfg(feature = "chains")]
34pub mod chains;
35pub mod connection;
36pub mod device;
37
38pub mod error;
39pub use crate::error::{Error, WindowingApiError};
40
41mod context;
42pub use crate::context::{ContextAttributeFlags, ContextAttributes, ContextID};
43
44mod info;
45pub use crate::info::{GLApi, GLVersion};
46
47mod surface;
48pub use crate::surface::{SurfaceAccess, SurfaceID, SurfaceInfo, SurfaceType, SystemSurfaceInfo};
49
50pub mod macros;
51pub(crate) use macros::implement_interfaces;
52
53pub(crate) use glow::{self as gl, Context as Gl};
54
55mod gl_utils;
56mod renderbuffers;
57
58#[cfg(any(
59    target_os = "android",
60    target_env = "ohos",
61    all(target_os = "windows", feature = "sm-angle"),
62    unix
63))]
64#[allow(non_camel_case_types)]
65#[allow(clippy::all)]
66mod egl {
67    use std::os::raw::{c_long, c_void};
68    pub type khronos_utime_nanoseconds_t = khronos_uint64_t;
69    pub type khronos_uint64_t = u64;
70    pub type khronos_ssize_t = c_long;
71    pub type EGLint = i32;
72    pub type EGLNativeDisplayType = *const c_void;
73    pub type EGLNativePixmapType = *const c_void;
74    pub type EGLNativeWindowType = *const c_void;
75    pub type NativeDisplayType = EGLNativeDisplayType;
76    pub type NativePixmapType = EGLNativePixmapType;
77    pub type NativeWindowType = EGLNativeWindowType;
78    include!(concat!(env!("OUT_DIR"), "/egl_bindings.rs"));
79}