diff --git a/intern/cycles/device/memory.cpp b/intern/cycles/device/memory.cpp index a6c695d344a..0c446b1d75b 100644 --- a/intern/cycles/device/memory.cpp +++ b/intern/cycles/device/memory.cpp @@ -9,7 +9,7 @@ CCL_NAMESPACE_BEGIN /* Device Memory */ -device_memory::device_memory(Device *device, const char *name, MemoryType type) +device_memory::device_memory(Device *device, const char *_name, MemoryType type) : data_type(device_type_traits::data_type), data_elements(device_type_traits::num_elements), data_size(0), @@ -18,7 +18,7 @@ device_memory::device_memory(Device *device, const char *name, MemoryType type) data_height(0), data_depth(0), type(type), - name(name), + name_storage(_name), device(device), device_pointer(0), host_pointer(0), @@ -30,6 +30,7 @@ device_memory::device_memory(Device *device, const char *name, MemoryType type) need_realloc_(false), modified(false) { + name = name_storage.c_str(); } device_memory::~device_memory() diff --git a/intern/cycles/device/memory.h b/intern/cycles/device/memory.h index 9fe46e3148d..7d27f457548 100644 --- a/intern/cycles/device/memory.h +++ b/intern/cycles/device/memory.h @@ -233,6 +233,7 @@ class device_memory { size_t data_depth; MemoryType type; const char *name; + std::string name_storage; /* Pointers. */ Device *device; diff --git a/intern/cycles/integrator/path_trace_work_gpu.cpp b/intern/cycles/integrator/path_trace_work_gpu.cpp index 0c0bad0d5f6..4fc60703ba5 100644 --- a/intern/cycles/integrator/path_trace_work_gpu.cpp +++ b/intern/cycles/integrator/path_trace_work_gpu.cpp @@ -128,8 +128,8 @@ void PathTraceWorkGPU::alloc_integrator_soa() for (int array_index = 0;; array_index++) { #define KERNEL_STRUCT_MEMBER(parent_struct, type, name, feature) \ if ((kernel_features & (feature)) && (integrator_state_gpu_.parent_struct.name == nullptr)) { \ - device_only_memory *array = new device_only_memory(device_, \ - "integrator_state_" #name); \ + string name_str = string_printf("%sintegrator_state_" #name, shadow ? "shadow_" : ""); \ + device_only_memory *array = new device_only_memory(device_, name_str.c_str()); \ array->alloc_to_device(max_num_paths_); \ integrator_state_soa_.emplace_back(array); \ integrator_state_gpu_.parent_struct.name = (type *)array->device_pointer; \ @@ -138,8 +138,9 @@ void PathTraceWorkGPU::alloc_integrator_soa() if ((kernel_features & (feature)) && \ (integrator_state_gpu_.parent_struct[array_index].name == nullptr)) \ { \ - device_only_memory *array = new device_only_memory(device_, \ - "integrator_state_" #name); \ + string name_str = string_printf( \ + "%sintegrator_state_" #name "_%d", shadow ? "shadow_" : "", array_index); \ + device_only_memory *array = new device_only_memory(device_, name_str.c_str()); \ array->alloc_to_device(max_num_paths_); \ integrator_state_soa_.emplace_back(array); \ integrator_state_gpu_.parent_struct[array_index].name = (type *)array->device_pointer; \ @@ -155,8 +156,9 @@ void PathTraceWorkGPU::alloc_integrator_soa() } #define KERNEL_STRUCT_VOLUME_STACK_SIZE (integrator_state_soa_volume_stack_size_) + bool shadow = false; #include "kernel/integrator/state_template.h" - + shadow = true; #include "kernel/integrator/shadow_state_template.h" #undef KERNEL_STRUCT_BEGIN