diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-10-20 05:32:29 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-10-21 21:58:28 +0300 |
commit | 57a0cb797d60024357a3e3a64c1873844b0178bd (patch) | |
tree | 1f8ade576fbbc6cbbf7a41c51304ee8ae3fe95b6 /intern/cycles/util/util_vector.h | |
parent | 92ec4863c22f249a21a5b5224d91fcab5c602100 (diff) |
Code refactor: avoid some unnecessary device memory copying.
Diffstat (limited to 'intern/cycles/util/util_vector.h')
-rw-r--r-- | intern/cycles/util/util_vector.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/intern/cycles/util/util_vector.h b/intern/cycles/util/util_vector.h index 4add91a3368..9e74505b14a 100644 --- a/intern/cycles/util/util_vector.h +++ b/intern/cycles/util/util_vector.h @@ -273,6 +273,15 @@ public: push_back_slow(t); } + void append(const array<T>& from) + { + if(from.size()) { + size_t old_size = size(); + resize(old_size + from.size()); + memcpy(data_ + old_size, from.data(), sizeof(T) * from.size()); + } + } + protected: inline T* mem_allocate(size_t N) { |