opencl_sys/
cl_layer.rs

1// Copyright (c) 2023 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//! FFI bindings for [cl_layer.h](https://github.com/KhronosGroup/OpenCL-Headers/blob/main/CL/cl_layer.h)
16
17#![allow(non_camel_case_types, non_snake_case)]
18
19pub use super::cl_icd::cl_icd_dispatch;
20use super::cl_platform::{cl_int, cl_uint};
21use libc::{c_void, size_t};
22
23// cl_loader_layers
24pub type cl_layer_info = cl_uint;
25pub type cl_layer_api_version = cl_uint;
26
27pub const CL_LAYER_API_VERSION: cl_layer_info = 0x4240;
28pub const CL_LAYER_NAME: cl_layer_info = 0x4241;
29
30pub const CL_LAYER_API_VERSION_100: cl_layer_api_version = 100;
31
32pub type clGetLayerInfo_t = Option<
33    unsafe extern "C" fn(
34        param_name: cl_layer_info,
35        param_value_size: size_t,
36        param_value: *mut c_void,
37        param_value_size_ret: *mut size_t,
38    ) -> cl_int,
39>;
40pub type clGetLayerInfo_fn = clGetLayerInfo_t;
41pub type clInitLayer_t = Option<
42    unsafe extern "C" fn(
43        num_entries: cl_uint,
44        target_dispatch: *const cl_icd_dispatch,
45        num_entries_ret: *mut cl_uint,
46        layer_dispatch_ret: *mut *const cl_icd_dispatch,
47    ) -> cl_int,
48>;
49pub type clInitLayer_fn = clInitLayer_t;
50
51pub type pfn_clGetLayerInfo = clGetLayerInfo_t;
52pub type pfn_clInitLayer = clInitLayer_t;
53
54#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
55#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
56#[cfg(feature = "cl_loader_layers")]
57#[cfg(feature = "static")]
58unsafe extern "system" {
59    pub fn clGetLayerInfo(
60        param_name: cl_layer_info,
61        param_value_size: size_t,
62        param_value: *mut c_void,
63        param_value_size_ret: *mut size_t,
64    ) -> cl_int;
65
66    pub fn clInitLayer(
67        num_entries: cl_uint,
68        target_dispatch: *const cl_icd_dispatch,
69        num_entries_ret: *mut cl_uint,
70        layer_dispatch_ret: *mut *const cl_icd_dispatch,
71    ) -> cl_int;
72}