Skip to content

Commit

Permalink
FIx clippy warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenba committed Nov 17, 2024
1 parent 72a7cf2 commit e985b29
Show file tree
Hide file tree
Showing 16 changed files with 99 additions and 84 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ path = "examples/clinfo.rs"
enum_glob_use = "deny"
missing_errors_doc = "allow"
module_name_repetitions = "allow"
nursery = "deny"
pedantic = "deny"
nursery = { level = "deny", priority = -1 }
pedantic = { level = "deny", priority = -1 }
unwrap_used = "deny"
12 changes: 7 additions & 5 deletions src/command_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ use libc::{c_void, intptr_t, size_t};
use std::mem;
use std::ptr;

/// Create an `OpenCL` host or device command-queue on a specific device.
/// Create an `OpenCL` host or device command-queue on a specific device.
///
/// Calls `clCreateCommandQueue` to create an `OpenCL` context.
/// Deprecated in `CL_VERSION_2_0` by `create_command_queue_with_properties`.
///
/// * `context` - a valid `OpenCL` context.
/// * `device` - a device or sub-device associated with context.
/// * `properties` - a list of properties for the command-queue, see
/// [cl_command_queue_properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#legacy-queue-properties-table).
/// [cl_command_queue_properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#legacy-queue-properties-table).
///
/// returns a Result containing the new `OpenCL` command-queue
/// or the error code from the `OpenCL` C API function.
Expand Down Expand Up @@ -99,14 +100,15 @@ pub unsafe fn create_command_queue(
}
}

/// Create an `OpenCL` host or device command-queue on a specific device.
/// Create an `OpenCL` host or device command-queue on a specific device.
///
/// Calls clCreateCommandQueueWithProperties to create an `OpenCL` context.
/// `CL_VERSION_2_0` onwards.
///
/// * `context` - a valid `OpenCL` context.
/// * `device` - a device or sub-device associated with context.
/// * `properties` - a null terminated list of properties for the command-queue, see
/// [cl_queue_properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#queue-properties-table).
/// [cl_queue_properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#queue-properties-table).
///
/// returns a Result containing the new `OpenCL` command-queue
/// or the error code from the `OpenCL` C API function.
Expand Down Expand Up @@ -188,7 +190,7 @@ pub fn get_command_queue_data(
///
/// * `command_queue` - the `OpenCL` command-queue.
/// * `param_name` - the type of command-queue information being queried, see:
/// [Command Queue Parameter](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#command-queue-param-table).
/// [Command Queue Parameter](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#command-queue-param-table).
///
/// returns a Result containing the desired information in an `InfoType` enum
/// or the error code from the `OpenCL` C API function.
Expand Down
8 changes: 4 additions & 4 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use std::ptr;
///
/// * `devices` - a slice of unique devices for an `OpenCL` platform.
/// * `properties` - a null terminated list of `cl_context_properties`, see
/// [Context Properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#context-properties-table).
/// [Context Properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#context-properties-table).
/// * `pfn_notify` - an optional callback function that can be registered by the application.
/// * `user_data` - passed as the `user_data` argument when `pfn_notify` is called.
///
Expand Down Expand Up @@ -78,9 +78,9 @@ pub fn create_context(
/// Calls `clCreateContextFromType` to create an `OpenCL` context.
///
/// * `device_type` - the type of `OpenCL` device, see:
/// [Device Types](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#device-types-table).
/// [Device Types](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#device-types-table).
/// * `properties` - a null terminated list of `cl_context_properties`, see:
/// [Context Properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#context-properties-table).
/// [Context Properties](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#context-properties-table).
/// * `pfn_notify` - an optional callback function that can be registered by the application.
/// * `user_data` - passed as the `user_data` argument when `pfn_notify` is called.
///
Expand Down Expand Up @@ -161,7 +161,7 @@ pub fn get_context_data(
///
/// * `context` - the `cl_context` of the `OpenCL` context.
/// * `param_name` - the type of platform information being queried, see:
/// [Context Attributes](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#context-info-table).
/// [Context Attributes](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#context-info-table).
///
/// returns a Result containing the desired information in an `InfoType` enum
/// or the error code from the `OpenCL` C API function.
Expand Down
3 changes: 2 additions & 1 deletion src/d3d10.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! FFI bindings for `cl_d3d10.h`
//! FFI bindings for `cl_d3d10.h`
//!
//! `cl_d3d10.h` contains `OpenCL` extensions that provide interoperability with `Direct3D` 10.
//! `OpenCL` extensions are documented in the [OpenCL-Registry](https://github.com/KhronosGroup/OpenCL-Registry)
Expand Down
3 changes: 2 additions & 1 deletion src/d3d11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! FFI bindings for `cl_d3d11.h`
//! FFI bindings for `cl_d3d11.h`
//!
//! `cl_d3d11.h` contains `OpenCL` extensions that provide interoperability with `Direct3D` 11.
//! `OpenCL` extensions are documented in the [OpenCL-Registry](https://github.com/KhronosGroup/OpenCL-Registry)
Expand Down
9 changes: 5 additions & 4 deletions src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ use std::ptr;
/// ```
/// * `platform` - the `cl_platform_id` of the `OpenCL` platform.
/// * `device_type` - the type of device, see
/// [Device Types](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#device-types-table).
/// [Device Types](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#device-types-table).
///
/// returns a Result containing a vector of available device ids
/// or the error code from the `OpenCL` C API function.
Expand Down Expand Up @@ -232,7 +232,7 @@ pub fn get_device_data(
/// ```
/// * `device` - the `cl_device_id` of the `OpenCL` device.
/// * `param_name` - the type of device information being queried, see
/// [Device Queries](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#device-queries-table).
/// [Device Queries](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#device-queries-table).
///
/// returns a Result containing the desired information in an `InfoType` enum
/// or the error code from the `OpenCL` C API function.
Expand Down Expand Up @@ -586,7 +586,7 @@ fn count_sub_devices(
///
/// * `in_device` - the `cl_device_id` of the `OpenCL` device to partition.
/// * `properties` - the slice of `cl_device_partition_property`, see
/// [Subdevice Partition](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#subdevice-partition-table).
/// [Subdevice Partition](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#subdevice-partition-table).
///
/// returns a Result containing a vector of available sub-device ids
/// or the error code from the `OpenCL` C API function.
Expand Down Expand Up @@ -671,7 +671,7 @@ pub unsafe fn release_device(device: cl_device_id) -> Result<(), cl_int> {
/// * `context` - the `OpenCL` context used to create `command_queue`.
/// * `device` - a valid `OpenCL` device associated with context.
/// * `command_queue` - a command queue object which replaces the default
/// device command queue.
/// device command queue.
///
/// returns an empty Result or the error code from the `OpenCL` C API function.
#[cfg(feature = "CL_VERSION_2_1")]
Expand Down Expand Up @@ -733,6 +733,7 @@ pub fn get_host_timer(device: cl_device_id) -> Result<cl_ulong, cl_int> {
// #endif

/// Device Vendor Ids.
///
/// The `PCie` IDs of some `OpenCL` device vendors as returned by `get_device_info`,
/// i.e.: `clGetDeviceInfo` - `CL_DEVICE_VENDOR_ID`
/// They were obtained from the `PCIe` ID Repository: <https://pci-ids.ucw.cz/>
Expand Down
1 change: 1 addition & 0 deletions src/dx9_media_sharing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

//! FFI bindings for `cl_dx9_media_sharing.h`
//!
//! `cl_ecl_dx9_media_sharing.h` contains `OpenCL` extensions that provide interoperability with `Direct3D` 9.
//! `OpenCL` extensions are documented in the [OpenCL-Registry](https://github.com/KhronosGroup/OpenCL-Registry)
Expand Down
2 changes: 1 addition & 1 deletion src/egl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use std::ptr;
/// * `image` - should be of type `EGLImageKHR`, cast into the type `CLeglImageKHR`.
/// * `flags` - usage information about the memory object being created.
/// * `properties` - a null terminated list of property names and their
/// corresponding values.
/// corresponding values.
///
/// returns a Result containing the new `OpenCL` image object
/// or the error code from the `OpenCL` C API function.
Expand Down
4 changes: 2 additions & 2 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub fn get_event_data(event: cl_event, param_name: cl_event_info) -> Result<Vec<
///
/// * `event` - the `OpenCL` event.
/// * `param_name` - the type of program information being queried, see:
/// [Event Object Queries](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#event-info-table).
/// [Event Object Queries](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#event-info-table).
///
/// returns a Result containing the desired information in an `InfoType` enum
/// or the error code from the `OpenCL` C API function.
Expand Down Expand Up @@ -232,7 +232,7 @@ pub fn get_event_profiling_data(
///
/// * `event` - the `OpenCL` event.
/// * `param_name` - the type of event profiling information being queried, see:
/// [Event Profiling Queries](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#event-profiling-info-table).
/// [Event Profiling Queries](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#event-profiling-info-table).
///
/// returns a Result containing the desired information in an `InfoType` enum
/// or the error code from the `OpenCL` C API function.
Expand Down
39 changes: 23 additions & 16 deletions src/gl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ use std::ptr;
///
/// * `context` - a valid `OpenCL` context created from an OpenGL context.
/// * `flags` - a bit-field used to specify allocation and usage information
/// about the image memory object being created, see:
/// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table).
/// about the image memory object being created, see:
/// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table).
/// * `bufobj` - the OpenGL buffer.
///
/// returns a Result containing the new `OpenCL` buffer object
Expand All @@ -70,15 +70,16 @@ pub unsafe fn create_from_gl_buffer(
}
}

/// Create an `OpenCL` image object, image array object, or image buffer object
/// for a context from an OpenGL texture object, texture array object,
/// Create an `OpenCL` image object, image array object, or image buffer object.
///
/// For a context from an OpenGL texture object, texture array object,
/// texture buffer object, or a single face of an OpenGL cubemap texture object.
/// Calls clCreateFromGLTexture to create an `OpenCL` memory object.
///
/// * `context` - a valid `OpenCL` context created from an OpenGL context.
/// * `flags` - a bit-field used to specify allocation and usage information
/// about the image memory object being created, see:
/// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table).
/// about the image memory object being created, see:
/// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table).
/// * `texture_target` - used to define the image type of texture.
/// * `miplevel ` - used to define the mipmap level.
/// * `texture ` - the name of a GL buffer texture object.
Expand Down Expand Up @@ -109,13 +110,14 @@ pub unsafe fn create_from_gl_texture(
}
}

/// Create an `OpenCL` 2D image object from an OpenGL renderbuffer object.
/// Create an `OpenCL` 2D image object from an OpenGL renderbuffer object.
///
/// Calls clCreateFromGLRenderbuffer to create an `OpenCL` buffer object.
///
/// * `context` - a valid `OpenCL` context created from an OpenGL context.
/// * `flags` - a bit-field used to specify allocation and usage information
/// about the image memory object being created, see:
/// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table).
/// about the image memory object being created, see:
/// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table).
/// * `renderbuffer` - a GL renderbuffer object.
///
/// returns a Result containing the new `OpenCL` image object
Expand All @@ -136,6 +138,7 @@ pub unsafe fn create_from_gl_render_buffer(
}

/// Query an OpenGL object used to create an `OpenCL` memory object.
///
/// Calls clGetGLObjectInfo to get the object type and name.
///
/// * `memobj` - a valid `OpenCL` memory object handle.
Expand All @@ -155,6 +158,7 @@ pub fn get_gl_object_info(memobj: cl_mem) -> Result<(cl_GLuint, cl_GLuint), cl_i
}

/// Get data about an OpenGL texture object.
///
/// Calls clGetGLTextureInfo to get the desired data about the texture object.
pub fn get_gl_texture_data(
memobj: cl_mem,
Expand All @@ -167,11 +171,12 @@ pub fn get_gl_texture_data(
}

/// Get information about the GL texture object associated with a memory object.
///
/// Calls clGetGLTextureInfo to get the desired information.
///
/// * `memobj` - the `OpenCL` memory object.
/// * `param_name` - the type of memory object information being queried, see:
/// [Texture Info](https://www.khronos.org/registry/OpenCL//sdk/2.2/docs/man/html/clGetGLTextureInfo.html).
/// [Texture Info](https://www.khronos.org/registry/OpenCL//sdk/2.2/docs/man/html/clGetGLTextureInfo.html).
///
/// returns a Result containing the desired information in an `InfoType` enum
/// or the error code from the `OpenCL` C API function.
Expand Down Expand Up @@ -265,14 +270,15 @@ pub unsafe fn enqueue_release_gl_objects(
}

/// Create an `OpenCL` 2D image object from an `OpenGL` 2D texture object,
/// or a single face of an OpenGL cubemap texture object.
/// or a single face of an OpenGL cubemap texture object.
///
/// Calls clCreateFromGLTexture2D to create an `OpenCL` memory object.
/// Deprecated in `CL_VERSION_1_2`, use `create_from_gl_texture`.
///
/// * `context` - a valid `OpenCL` context created from an OpenGL context.
/// * `flags` - a bit-field used to specify allocation and usage information
/// about the image memory object being created, see:
/// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table).
/// about the image memory object being created, see:
/// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table).
/// * `texture_target` - used to define the image type of texture.
/// * `miplevel ` - used to define the mipmap level.
/// * `texture ` - the name of a GL 2D, cubemap or rectangle texture object.
Expand Down Expand Up @@ -317,13 +323,14 @@ pub unsafe fn create_from_gl_texture_2d(
}

/// Create an `OpenCL` 3D image object from an OpenGL 3D texture object.
///
/// Calls `clCreateFromGLTexture3D` to create an `OpenCL` memory object.
/// Deprecated in `CL_VERSION_1_2`, use `create_from_gl_texture`.
///
/// * `context` - a valid `OpenCL` context created from an OpenGL context.
/// * `flags` - a bit-field used to specify allocation and usage information
/// about the image memory object being created, see:
/// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table).
/// about the image memory object being created, see:
/// [Memory Flags](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#memory-flags-table).
/// * `texture_target` - used to define the image type of texture.
/// * `miplevel ` - used to define the mipmap level.
/// * `texture ` - the name of a GL 2D, cubemap or rectangle texture object.
Expand Down Expand Up @@ -372,7 +379,7 @@ pub unsafe fn create_from_gl_texture_3d(
///
/// * `properties` - the `OpenCL` context properties.
/// * `param_name` - the type of memory object information being queried, see:
/// [Context Info](https://www.khronos.org/registry/OpenCL//sdk/2.2/docs/man/html/clGetGLContextInfoKHR.html).
/// [Context Info](https://www.khronos.org/registry/OpenCL//sdk/2.2/docs/man/html/clGetGLContextInfoKHR.html).
///
/// returns a Result containing the desired information in an `InfoType` enum
/// or the error code from the `OpenCL` C API function.
Expand Down
Loading

0 comments on commit e985b29

Please sign in to comment.