diff options
author | Mai Lavelle <mai.lavelle@gmail.com> | 2016-12-14 04:45:09 +0300 |
---|---|---|
committer | Mai Lavelle <mai.lavelle@gmail.com> | 2017-03-08 09:24:55 +0300 |
commit | b78e543af9f6a967e239a88422c8e8a697162463 (patch) | |
tree | e17f1f9f795cb1476788c8b59674f4cb54aae4f5 /intern/cycles/device/device_network.cpp | |
parent | 817873cc83034c460f1be6bf410c95ff009f3ae2 (diff) |
Cycles: Add names to buffer allocations
This is to help debug and track memory usage for generic buffers. We
have similar for textures already since those require a name, but for
buffers the name is only for debugging proposes.
Diffstat (limited to 'intern/cycles/device/device_network.cpp')
-rw-r--r-- | intern/cycles/device/device_network.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/intern/cycles/device/device_network.cpp b/intern/cycles/device/device_network.cpp index 53eef6cf199..6dc4aecbc50 100644 --- a/intern/cycles/device/device_network.cpp +++ b/intern/cycles/device/device_network.cpp @@ -87,8 +87,14 @@ public: snd.write(); } - void mem_alloc(device_memory& mem, MemoryType type) + void mem_alloc(const char *name, device_memory& mem, MemoryType type) { + if(name) { + VLOG(1) << "Buffer allocate: " << name << ", " + << string_human_readable_number(mem.memory_size()) << " bytes. (" + << string_human_readable_size(mem.memory_size()) << ")"; + } + thread_scoped_lock lock(rpc_lock); mem.device_pointer = ++mem_counter; @@ -481,7 +487,7 @@ protected: mem.data_pointer = 0; /* perform the allocation on the actual device */ - device->mem_alloc(mem, type); + device->mem_alloc(NULL, mem, type); /* store a mapping to/from client_pointer and real device pointer */ pointer_mapping_insert(client_pointer, mem.device_pointer); |