Struct ocl::Context [] [src]

pub struct Context {
    // some fields omitted
}

A context for a particular platform and set of device types.

Thread safety and destruction for any enclosed pointers are all handled automatically. Clone, store, and share between threads to your heart's content.

[TODO]: Consider removing contained copies of the device id list and platform id. Can be easily ascertained via the API.

Methods

impl Context
[src]

fn builder() -> ContextBuilder

Returns a ContextBuilder.

This is the preferred way to create a Context.

fn new(properties: Option<ContextProperties>, device_spec: Option<DeviceSpecifier>, pfn_notify: Option<CreateContextCallbackFn>, user_data: Option<UserDataPtr>) -> OclResult<Context>

Returns a newly created context.

Prefer Context::builder()... instead of this method unless you know what you're doing. Please also immediately contact us if you do, in fact, know what you're doing so that you can be added to the development team as the one who does.

Defaults

  • The 'NULL' platform (which is not to be relied on but is generally the first avaliable).
  • All devices associated with the 'NULL' platform
  • No notify callback function or user data.

Don't rely on these defaults, instead rely on the ContextBuilder defaults. In other words, use: Context::builder().build().unwrap() rather than Context::new(None, None, None, None).unwrap().

Panics

[TEMPORARY] Passing a Some variant for pfn_notify or user_data is not yet supported.

fn resolve_wrapping_device_idxs(&self, idxs: &[usize]) -> Vec<Device>

Resolves a list of zero-based device indices into a list of Devices.

If any index is out of bounds it will wrap around zero (%) to the next valid device index.

fn get_device_by_wrapping_index(&self, index: usize) -> Device

Returns a device by its ordinal count within this context.

Round-robins (%) to the next valid device.

fn platform_info(&self, info_kind: PlatformInfo) -> PlatformInfoResult

Returns info about the platform associated with the context.

fn device_info(&self, index: usize, info_kind: DeviceInfo) -> DeviceInfoResult

Returns info about the device indexed by index associated with this context.

fn info(&self, info_kind: ContextInfo) -> ContextInfoResult

Returns info about the context.

fn core_as_ref(&self) -> &ContextCore

Returns a reference to the core pointer wrapper, usable by functions in the core module.

fn devices(&self) -> &[Device]

Returns the list of devices associated with this context.

fn platform(&self) -> Option<Platform>

Returns the platform this context is associated with.

Methods from Deref<Target=ContextCore>

unsafe fn as_ptr(&self) -> cl_context

Returns a pointer, do not store it.

Trait Implementations

impl Clone for Context
[src]

fn clone(&self) -> Context

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Debug for Context
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Display for Context
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Deref for Context
[src]

type Target = ContextCore

The resulting type after dereferencing

fn deref(&self) -> &ContextCore

The method called to dereference a value

impl DerefMut for Context
[src]

fn deref_mut(&mut self) -> &mut ContextCore

The method called to mutably dereference a value