Enum ocl_core::types::enums::KernelArg [] [src]

pub enum KernelArg<'a, T: 'a + OclPrm> {
    Mem(&'a Mem),
    MemNull,
    Sampler(&'a Sampler),
    SamplerNull,
    Scalar(T),
    Vector(T),
    Local(&'a usize),
    UnsafePointer {
        size: size_t,
        value: *const c_void,
    },
}

[UNSAFE] Kernel argument option type.

The type argument T is ignored for Mem, Sampler, and UnsafePointer (just put usize or anything).

Safety

If there was some way for this enum to be marked unsafe it would be.

The Mem, Sampler, Scalar, and Local variants are tested and will work perfectly well.

  • Vector: The Vector variant is poorly tested and probably a bit platform dependent. Use at your own risk.
  • UnsafePointer: Really know what you're doing when using the UnsafePointer variant. Setting its properties, size and value, incorrectly can cause bugs, crashes, and data integrity issues that are very hard to track down. This is due to the fact that the pointer value is intended to be a pointer to a memory structure in YOUR programs memory, NOT a copy of an OpenCL object pointer (such as a cl_h::cl_mem for example, which is itself a *mut libc::c_void). This is made more complicated by the fact that the pointer can also be a pointer to a scalar (ex: *const u32, etc.). See the SDK docs for more details.

Variants

Type T is ignored.

Type T is ignored.

Type T is ignored.

Type T is ignored.

Length in multiples of T (not bytes).

size: size in bytes. Type T is ignored.

Fields of UnsafePointer

Trait Implementations

impl<'a, T: Debug + 'a + OclPrm> Debug for KernelArg<'a, T>
[src]

Formats the value using the given formatter.