Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/device/device_cpu.cpp
| Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | #endif | ||||
| void const_copy_to(const char *name, void *host, size_t size) | void const_copy_to(const char *name, void *host, size_t size) | ||||
| { | { | ||||
| kernel_const_copy(&kernel_globals, name, host, size); | kernel_const_copy(&kernel_globals, name, host, size); | ||||
| } | } | ||||
| void tex_alloc(const char *name, | void tex_alloc(const char *name, | ||||
| device_memory& mem, | device_memory& mem, | ||||
| InterpolationType interpolation, | InterpolationType interpolation, | ||||
| ExtensionType extension) | ExtensionType extension, | ||||
| uint* /*bindless_slot*/) | |||||
brecht: If we're making slots part of the device API, then I think it makes sense to not only do it for… | |||||
| { | { | ||||
| VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes."; | VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes."; | ||||
| kernel_tex_copy(&kernel_globals, | kernel_tex_copy(&kernel_globals, | ||||
| name, | name, | ||||
| mem.data_pointer, | mem.data_pointer, | ||||
| mem.data_width, | mem.data_width, | ||||
| mem.data_height, | mem.data_height, | ||||
| mem.data_depth, | mem.data_depth, | ||||
| interpolation, | interpolation, | ||||
| extension); | extension); | ||||
| mem.device_pointer = mem.data_pointer; | mem.device_pointer = mem.data_pointer; | ||||
| mem.device_size = mem.memory_size(); | mem.device_size = mem.memory_size(); | ||||
| stats.mem_alloc(mem.device_size); | stats.mem_alloc(mem.device_size); | ||||
| } | } | ||||
| void tex_free(device_memory& mem) | void tex_free(device_memory& mem) | ||||
Done Inline ActionsThis is effectively way to a memory leak, you modified tex_free() signature here, which is now different from base class, meaning this code will never run. sergey: This is effectively way to a memory leak, you modified `tex_free()` signature here, which is… | |||||
| { | { | ||||
| if(mem.device_pointer) { | if(mem.device_pointer) { | ||||
| mem.device_pointer = 0; | mem.device_pointer = 0; | ||||
| stats.mem_free(mem.device_size); | stats.mem_free(mem.device_size); | ||||
| mem.device_size = 0; | mem.device_size = 0; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 338 Lines • Show Last 20 Lines | |||||
If we're making slots part of the device API, then I think it makes sense to not only do it for bindless CUDA textures, but for CPU textures too, which are now decoding the slot from the name string.
Doesn't have to be done as part of this patch or even soon, but would make the code nicer I think.