Beispiel #1
0
/**
 * Get the device wrapper for the given OpenCL device.
 *
 * If the wrapper doesn't exist, it's created with a reference count
 * of 1. Otherwise, the existing wrapper is returned and its reference
 * count is incremented by 1.
 *
 * This function will rarely be called from client code, except when
 * clients wish to get the OpenCL device directly (using the
 * clGetDeviceIDs() function) and then wrap the OpenCL device in a
 * ::CCLDevice wrapper object.
 *
 * @public @memberof ccl_device
 *
 * @param[in] device The OpenCL device to be wrapped.
 * @return The device wrapper for the given OpenCL device.
 * */
CCL_EXPORT
CCLDevice * ccl_device_new_wrap(cl_device_id device) {

    return (CCLDevice *) ccl_wrapper_new(
        CCL_DEVICE, (void *) device, sizeof(CCLDevice));

}
Beispiel #2
0
/**
 * Get the kernel wrapper for the given OpenCL kernel.
 *
 * If the wrapper doesn't exist, its created with a reference count
 * of 1. Otherwise, the existing wrapper is returned and its reference
 * count is incremented by 1.
 *
 * This function will rarely be called from client code, except when
 * clients wish to create the OpenCL kernel directly (using the
 * clCreateKernel() function) and then wrap the OpenCL kernel in a
 * ::CCLKernel wrapper object.
 *
 * @public @memberof ccl_kernel
 *
 * @param[in] kernel The OpenCL kernel to be wrapped.
 * @return The ::CCLKernel wrapper for the given OpenCL kernel.
 * */
CCL_EXPORT
CCLKernel* ccl_kernel_new_wrap(cl_kernel kernel) {

	return (CCLKernel*) ccl_wrapper_new(
		CCL_KERNEL, (void*) kernel, sizeof(CCLKernel));

}
Beispiel #3
0
/**
 * Get the sampler wrapper for the given OpenCL sampler.
 *
 * If the wrapper doesn't exist, its created with a reference count
 * of 1. Otherwise, the existing wrapper is returned and its reference
 * count is incremented by 1.
 *
 * This function will rarely be called from client code, except when
 * clients wish to directly wrap an OpenCL sampler in a
 * ::CCLSampler wrapper object.
 *
 * @protected @memberof ccl_sampler
 *
 * @param[in] sampler The OpenCL sampler to be wrapped.
 * @return The ::CCLSampler wrapper for the given OpenCL sampler.
 * */
CCL_EXPORT
CCLSampler* ccl_sampler_new_wrap(cl_sampler sampler) {

	return (CCLSampler*) ccl_wrapper_new(
		CCL_SAMPLER, (void*) sampler, sizeof(CCLSampler));

}
Beispiel #4
0
/**
 * Get the platform wrapper for the given OpenCL platform.
 *
 * If the wrapper doesn't exist, its created with a reference count
 * of 1. Otherwise, the existing wrapper is returned and its reference
 * count is incremented by 1.
 *
 * This function will rarely be called from client code, except when
 * clients wish to create the OpenCL platform directly (using the
 * clGetPlatformIDs() function) and then wrap the OpenCL platform in a
 * ::CCLPlatform wrapper object.
 *
 * @public @memberof ccl_platform
 *
 * @param[in] platform The OpenCL platform to be wrapped.
 * @return The ::CCLPlatform wrapper for the given OpenCL platform.
 * */
CCL_EXPORT
CCLPlatform * ccl_platform_new_wrap(cl_platform_id platform) {

    return (CCLPlatform *) ccl_wrapper_new(
        CCL_PLATFORM, (void *) platform, sizeof(CCLPlatform));
}