opencl_sys/lib.rs
1// Copyright (c) 2022-2024 Via Technology Ltd.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//](https://crates.io/crates/opencl-sys)
16//! [](https://docs.rs/opencl-sys/)
17//! [](https://www.khronos.org/registry/OpenCL/)
18//! [](https://opensource.org/licenses/Apache-2.0)
19//! 
20//!
21//! `OpenCL` C FFI bindings for the Rust programming language.
22//!
23//! # Description
24//!
25//! Rust [FFI](https://doc.rust-lang.org/nomicon/ffi.html) Bindings to the Khronos
26//! [OpenCL C language headers](https://github.com/KhronosGroup/OpenCL-Headers),
27//! see the [OpenCL Resource Guide](https://www.khronos.org/opencl/resources).
28//!
29//! The static API for `OpenCL` versions and extensions is controlled by Rust features
30//! such as "`static`", "`CL_VERSION_2_0`" and "`cl_khr_gl_sharing`".
31//!
32//! Rust deprecation warnings are given for `OpenCL` API functions that are
33//! deprecated by an enabled `OpenCL` version e.g., `clCreateCommandQueue` is
34//! deprecated whenever "`CL_VERSION_2_0`" is enabled.
35//!
36//! The Rust FFI files attempt to match the format and layout of the original
37//! C source files instead of [bindgen](https://rust-lang.github.io/rust-bindgen/)
38//! output files to ease maintenance.
39//!
40//! The library is declared [no_std](https://docs.rust-embedded.org/book/intro/no-std.html).
41//!
42//! ## Use
43//!
44//! `OpenCL` requires that an appropriate `OpenCL` hardware driver(s) and an `OpenCL` Installable Client Driver (ICD) are installed.\
45//! `OpenCL` GPU hardware driver(s) are installed with graphics drivers by the main manufacturers: Nvidia, AMD and Intel.\
46//! However, an `OpenCL` ICD must usually be installed manually by:
47//!
48//! - a Linux package manager, e.g., `sudo apt-get install intel-opencl-icd`
49//! - or a Windows download and install from
50//! <https://www.intel.com/content/www/us/en/developer/articles/technical/intel-cpu-runtime-for-opencl-applications-with-sycl-support.html>
51//!
52//! Note: you do *not* need to install an `OpenCL` ICD from the same manufacturer as your hardware.\
53//! In general the more up to date the `OpenCL` ICD, the better.
54//!
55//! ## Contribution
56//!
57//! If you want to contribute through code or documentation, the [Contributing](CONTRIBUTING.md)
58//! guide is the best place to start.\
59//! If you have any questions, please feel free to ask.
60//! Just please abide by our [Code of Conduct](CODE_OF_CONDUCT.md).
61//!
62//! ## License
63//!
64//! Licensed under the Apache License, Version 2.0, as per Khronos Group `OpenCL`.\
65//! You may obtain a copy of the License at: <http://www.apache.org/licenses/LICENSE-2.0>
66//!
67//! Unless you explicitly state otherwise, any contribution intentionally submitted
68//! for inclusion in the work by you, as defined in the Apache-2.0 license,
69//! shall be licensed as above, without any additional terms or conditions.
70//!
71//! `OpenCL` and the `OpenCL` logo are trademarks of Apple Inc. used under license by Khronos.
72
73#![no_std]
74
75extern crate libc;
76
77// Corresponds to opencl.h
78mod cl;
79mod cl_ext;
80// Note: The Intel extensions have been moved into cl_ext.h.
81// pub mod cl_ext_intel
82mod cl_gl;
83mod cl_platform;
84// Note: All OpenGL-related extensions have been moved into cl_gl.h.
85// pub mod cl_gl_ext
86
87pub use self::cl::*;
88pub use self::cl_ext::*;
89pub use self::cl_gl::*;
90pub use self::cl_platform::*;
91
92pub mod cl_d3d10;
93pub mod cl_d3d11;
94pub mod cl_dx9_media_sharing;
95// Note: Intel DX9 media sharing extensions have been moved into cl_dx9_media_sharing.h.
96// pub mod cl_dx9_media_sharing_intel
97pub mod cl_egl;
98
99pub mod cl_function_types;
100pub mod cl_icd;
101pub mod cl_layer;