Cycles: Disambiguate shadow integrator state buffer names
This patch adds a "shadow" prefix & array index suffixes to the shadow integrator state buffer names. This eliminates confusion when looking at GPU traces etc. Pull Request: https://projects.blender.org/blender/blender/pulls/121745
This commit is contained in:
committed by
Michael Jones (Apple)
parent
1036d9bdb2
commit
e82d69daa1
@@ -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<uchar>::data_type),
|
||||
data_elements(device_type_traits<uchar>::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()
|
||||
|
||||
@@ -233,6 +233,7 @@ class device_memory {
|
||||
size_t data_depth;
|
||||
MemoryType type;
|
||||
const char *name;
|
||||
std::string name_storage;
|
||||
|
||||
/* Pointers. */
|
||||
Device *device;
|
||||
|
||||
@@ -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<type> *array = new device_only_memory<type>(device_, \
|
||||
"integrator_state_" #name); \
|
||||
string name_str = string_printf("%sintegrator_state_" #name, shadow ? "shadow_" : ""); \
|
||||
device_only_memory<type> *array = new device_only_memory<type>(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<type> *array = new device_only_memory<type>(device_, \
|
||||
"integrator_state_" #name); \
|
||||
string name_str = string_printf( \
|
||||
"%sintegrator_state_" #name "_%d", shadow ? "shadow_" : "", array_index); \
|
||||
device_only_memory<type> *array = new device_only_memory<type>(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
|
||||
|
||||
Reference in New Issue
Block a user