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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2017-10-21 02:09:59 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2017-10-24 02:25:19 +0300
commit070a668d04844610059aaedc80c49e9038fd1779 (patch)
treecad5c64972e45b4ee19cc8e11cdd9adedd7a2f08 /intern/cycles/device/device.h
parentaa8b4c5d8124c0379eeee9eacd1a0887a573d7d7 (diff)
Code refactor: move more memory allocation logic into device API.
* Remove tex_* and pixels_* functions, replace by mem_*. * Add MEM_TEXTURE and MEM_PIXELS as memory types recognized by devices. * No longer create device_memory and call mem_* directly, always go through device_only_memory, device_vector and device_pixels.
Diffstat (limited to 'intern/cycles/device/device.h')
-rw-r--r--intern/cycles/device/device.h32
1 files changed, 15 insertions, 17 deletions
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 6bb65cde2a3..316bf70a5c3 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -281,28 +281,12 @@ public:
/* statistics */
Stats &stats;
- /* regular memory */
- virtual void mem_alloc(device_memory& mem) = 0;
- virtual void mem_copy_to(device_memory& mem) = 0;
- virtual void mem_copy_from(device_memory& mem,
- int y, int w, int h, int elem) = 0;
- virtual void mem_zero(device_memory& mem) = 0;
- virtual void mem_free(device_memory& mem) = 0;
-
+ /* memory alignment */
virtual int mem_address_alignment() { return 16; }
/* constant memory */
virtual void const_copy_to(const char *name, void *host, size_t size) = 0;
- /* texture memory */
- virtual void tex_alloc(device_memory& /*mem*/) {};
- virtual void tex_free(device_memory& /*mem*/) {};
-
- /* pixel memory */
- virtual void pixels_alloc(device_memory& mem);
- virtual void pixels_copy_from(device_memory& mem, int y, int w, int h);
- virtual void pixels_free(device_memory& mem);
-
/* open shading language, only for CPU device */
virtual void *osl_memory() { return NULL; }
@@ -349,6 +333,20 @@ public:
static void tag_update();
static void free_memory();
+
+protected:
+ /* Memory allocation, only accessed through device_memory. */
+ friend class MultiDevice;
+ friend class DeviceServer;
+ friend class device_memory;
+
+ virtual void mem_alloc(device_memory& mem) = 0;
+ virtual void mem_copy_to(device_memory& mem) = 0;
+ virtual void mem_copy_from(device_memory& mem,
+ int y, int w, int h, int elem) = 0;
+ virtual void mem_zero(device_memory& mem) = 0;
+ virtual void mem_free(device_memory& mem) = 0;
+
private:
/* Indicted whether device types and devices lists were initialized. */
static bool need_types_update, need_devices_update;