| 147 | |
| 148 | template<class BufferIterator, class T> |
| 149 | inline future<void> |
| 150 | dispatch_fill_async(BufferIterator first, |
| 151 | size_t count, |
| 152 | const T &value, |
| 153 | command_queue &queue, |
| 154 | typename boost::enable_if< |
| 155 | is_valid_fill_buffer_iterator<BufferIterator> |
| 156 | >::type* = 0) |
| 157 | { |
| 158 | typedef typename std::iterator_traits<BufferIterator>::value_type value_type; |
| 159 | |
| 160 | // check if the device supports OpenCL 1.2 (required for enqueue_fill_buffer) |
| 161 | if(!queue.check_device_version(1, 2)){ |
| 162 | return fill_async_with_copy(first, count, value, queue); |
| 163 | } |
| 164 | |
| 165 | value_type pattern = static_cast<value_type>(value); |
| 166 | size_t offset = static_cast<size_t>(first.get_index()); |
| 167 | |
| 168 | event event_ = |
| 169 | queue.enqueue_fill_buffer(first.get_buffer(), |
| 170 | &pattern, |
| 171 | sizeof(value_type), |
| 172 | offset * sizeof(value_type), |
| 173 | count * sizeof(value_type)); |
| 174 | |
| 175 | return future<void>(event_); |
| 176 | } |
| 177 | |
| 178 | #ifdef BOOST_COMPUTE_CL_VERSION_2_0 |
| 179 | // specializations for svm_ptr<T> |
no test coverage detected