Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/command_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,18 @@ unsafe impl Send for CommandQueue {}
unsafe impl Sync for CommandQueue {}

impl CommandQueue {
const fn new(queue: cl_command_queue, max_work_item_dimensions: cl_uint) -> Self {
pub const fn new(queue: cl_command_queue, max_work_item_dimensions: cl_uint) -> Self {
Self {
queue,
max_work_item_dimensions,
}
}

pub fn wrap_cl_command_queue(queue: cl_command_queue, device: &Device) -> Result<Self> {
let max_work_item_dimensions = device.max_work_item_dimensions()?;
Ok(Self::new(queue, max_work_item_dimensions))
}

/// Get the underlying OpenCL cl_command_queue.
pub const fn get(&self) -> cl_command_queue {
self.queue
Expand Down
6 changes: 5 additions & 1 deletion src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,17 @@ unsafe impl Send for Context {}
unsafe impl Sync for Context {}

impl Context {
fn new(context: cl_context, devices: &[cl_device_id]) -> Self {
pub fn new(context: cl_context, devices: &[cl_device_id]) -> Self {
Self {
context,
devices: devices.to_vec(),
}
}

pub fn wrap_cl_command_queue(context: cl_context, device: &Device) -> Self {
Self::new(context, &[device.id()])
}

/// Get the underlying OpenCL cl_context.
pub const fn get(&self) -> cl_context {
self.context
Expand Down