Esempio n. 1
0
 mapped_array map(const cl::CommandQueue &q) {
     return mapped_array(
             static_cast<T*>(
                 q.enqueueMapBuffer(
                     buffer, CL_TRUE, CL_MAP_READ | CL_MAP_WRITE,
                     0, size() * sizeof(T)
                     )
                 ),
             buffer_unmapper(q, buffer)
             );
 }
Esempio n. 2
0
 mapped_array map(boost::compute::command_queue q) const {
     return mapped_array(
             static_cast<T*>(
                 q.enqueue_map_buffer(
                     buffer, CL_MAP_READ,
                     0, size() * sizeof(T)
                     )
                 ),
             buffer_unmapper(q, buffer)
             );
 }
Esempio n. 3
0
 /**
  * \note The host memory gets unmapped automatically when the returned
  * pointer goes out of scope.
  */
 mapped_array map(const command_queue &q) {
     mapped_array ptr(new T[n], buffer_unmapper(q, *this));
     read(q, 0, n, ptr.get(), true);
     return ptr;
 }