Voxel
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Macros Pages
Public Types | Static Public Member Functions | List of all members
OpenCL::Converter< t_Type > Struct Template Reference

Converts data for transmission to OpenCL device. More...

#include <opencl_converter.h>

Public Types

typedef t_Type::OpenCLType Type

Static Public Member Functions

static Type Convert (t_Type const &source)

Detailed Description

template<typename t_Type>
struct OpenCL::Converter< t_Type >

Converts data for transmission to OpenCL device.

Parameters
t_TypeHost type from which to convert.

This class, and its specializations, are inspired by the way that boost::serialization works. Every convertable host type has two associated pieces of information: the OpenCL type to which it converts (stored in the Type typedef), and a function for actually performing the conversion (the Convert static function).

The default specialization of this class maps t_Type::OpenCLType to Type, and t_Type::OpenCLConvert to Convert. Hence, if you don't want to explicitly specialize this class for your type, you can instead add these two members, and they'll be used automatically.

This class is primarily used by Synchronized::Heap and Synchronized::TextureHeap, which keep the host state synchronized with OpenCL by, for every convertable object on the host, allocating a corresponding block of memory on the OpenCL device, and using this class to convert objects before transferring them over, whenever the host object changes.

See Also
Synchronized::Heap
Synchronized::TextureHeap

Definition at line 77 of file opencl_converter.h.


The documentation for this struct was generated from the following file: