pub struct Context { /* private fields */ }Expand description
An OpenCL context object. Implements the Drop trait to call release_context when the object is dropped.
Implementations§
source§impl Context
impl Context
sourcepub fn get(&self) -> cl_context
pub fn get(&self) -> cl_context
Get the underlying OpenCL cl_context.
sourcepub fn from_devices(
devices: &[cl_device_id],
properties: &[cl_context_properties],
pfn_notify: Option<unsafe extern "C" fn(_: *const c_char, _: *const c_void, _: size_t, _: *mut c_void)>,
user_data: *mut c_void
) -> Result<Context>
pub fn from_devices( devices: &[cl_device_id], properties: &[cl_context_properties], pfn_notify: Option<unsafe extern "C" fn(_: *const c_char, _: *const c_void, _: size_t, _: *mut c_void)>, user_data: *mut c_void ) -> Result<Context>
Create a Context from a slice of cl_device_ids.
devices- a slice of cl_device_ids for an OpenCL Platform.properties- a null terminated list of cl_context_properties, see Context Properties.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.
returns a Result containing the new OpenCL context or the error code from the OpenCL C API function.
sourcepub fn from_device(device: &Device) -> Result<Context>
pub fn from_device(device: &Device) -> Result<Context>
sourcepub fn from_sub_devices(
sub_devices: &[SubDevice],
properties: &[cl_context_properties],
pfn_notify: Option<unsafe extern "C" fn(_: *const c_char, _: *const c_void, _: size_t, _: *mut c_void)>,
user_data: *mut c_void
) -> Result<Context>
pub fn from_sub_devices( sub_devices: &[SubDevice], properties: &[cl_context_properties], pfn_notify: Option<unsafe extern "C" fn(_: *const c_char, _: *const c_void, _: size_t, _: *mut c_void)>, user_data: *mut c_void ) -> Result<Context>
Create a Context from a slice of SubDevices.
devices- a slice of SubDevices for an OpenCL Platform.properties- a null terminated list of cl_context_properties, see Context Properties.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.
returns a Result containing the new OpenCL context or the error code from the OpenCL C API function.
sourcepub fn from_device_type(
device_type: cl_device_type,
properties: &[cl_context_properties],
pfn_notify: Option<unsafe extern "C" fn(_: *const c_char, _: *const c_void, _: size_t, _: *mut c_void)>,
user_data: *mut c_void
) -> Result<Context>
pub fn from_device_type( device_type: cl_device_type, properties: &[cl_context_properties], pfn_notify: Option<unsafe extern "C" fn(_: *const c_char, _: *const c_void, _: size_t, _: *mut c_void)>, user_data: *mut c_void ) -> Result<Context>
Create a Context from a cl_device_type.
device_type- the cl_device_type to create a Context for.properties- a null terminated list of cl_context_properties, see Context Properties.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.
returns a Result containing the new OpenCL context or the error code from the OpenCL C API function.
sourcepub fn get_svm_mem_capability(&self) -> cl_device_svm_capabilities
pub fn get_svm_mem_capability(&self) -> cl_device_svm_capabilities
Get the common Shared Virtual Memory (SVM) capabilities of the devices in the Context.
sourcepub fn get_supported_image_formats(
&self,
flags: cl_mem_flags,
image_type: cl_mem_object_type
) -> Result<Vec<cl_image_format>>
pub fn get_supported_image_formats( &self, flags: cl_mem_flags, image_type: cl_mem_object_type ) -> Result<Vec<cl_image_format>>
Get the list of image formats supported by the Context for an image type,
and allocation information.
Calls clGetSupportedImageFormats to get the desired information about the context.
flags- a bit-field used to specify allocation and usage information about the image memory object being created, see: Memory Flags.image_type- describes the image type.
returns a Result containing the desired information in an InfoType enum or the error code from the OpenCL C API function.