| 82 | |
| 83 | template <typename T> |
| 84 | Status Buffer::ReadData(CLCommandQueue* queue, std::vector<T>* result) const { |
| 85 | if (size_ % sizeof(T) != 0) { |
| 86 | return UnknownError("Wrong element size(typename T is not correct?"); |
| 87 | } |
| 88 | |
| 89 | const int elements_count = size_ / sizeof(T); |
| 90 | result->resize(elements_count); |
| 91 | |
| 92 | return queue->EnqueueReadBuffer(buffer_, size_, result->data()); |
| 93 | } |
| 94 | |
| 95 | } // namespace cl |
| 96 | } // namespace gpu |