Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/device/device_memory.h')
-rw-r--r--intern/cycles/device/device_memory.h36
1 files changed, 12 insertions, 24 deletions
diff --git a/intern/cycles/device/device_memory.h b/intern/cycles/device/device_memory.h
index 20707ad04c9..eeeca61496e 100644
--- a/intern/cycles/device/device_memory.h
+++ b/intern/cycles/device/device_memory.h
@@ -270,31 +270,14 @@ public:
return &data[0];
}
- T *copy(T *ptr, size_t width, size_t height = 0, size_t depth = 0)
+ void steal_data(array<T>& from)
{
- T *mem = resize(width, height, depth);
- if(mem != NULL) {
- memcpy(mem, ptr, memory_size());
- }
- return mem;
- }
-
- void copy_at(T *ptr, size_t offset, size_t size)
- {
- if(size > 0) {
- size_t mem_size = size*data_elements*datatype_size(data_type);
- memcpy(&data[0] + offset, ptr, mem_size);
- }
- }
-
- void reference(T *ptr, size_t width, size_t height = 0, size_t depth = 0)
- {
- data.clear();
- data_size = width * ((height == 0)? 1: height) * ((depth == 0)? 1: depth);
- data_pointer = (device_ptr)ptr;
- data_width = width;
- data_height = height;
- data_depth = depth;
+ data.steal_data(from);
+ data_size = data.size();
+ data_pointer = (data_size)? (device_ptr)&data[0]: 0;
+ data_width = data_size;
+ data_height = 0;
+ data_depth = 0;
}
void clear()
@@ -318,6 +301,11 @@ public:
return &data[0];
}
+ T& operator[](size_t i)
+ {
+ return data[i];
+ }
+
private:
array<T> data;
};