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:
authorSergey Sharybin <sergey@blender.org>2021-10-05 16:05:12 +0300
committerSergey Sharybin <sergey@blender.org>2021-10-06 16:46:32 +0300
commitc6275da852eab77e2cea1ae601a43a2dbaad6c27 (patch)
treeb1b810367a23465e6b9188d9f862599bad07c3b3 /intern/cycles/kernel/kernel_types.h
parente41dddd29a17a77e60bde6a2336fcd3937819bec (diff)
Fix T91922: Cycles artifacts with high volume nested level
Make volume stack allocated conditionally, potentially based on the actual nested level of objects in the scene. Currently the nested level is estimated by number of volume objects. This is a non-expensive check which is probably enough in practice to get almost perfect memory usage and performance. The conditional allocation is a bit tricky. For the CPU we declare and define maximum possible volume stack, because there are only that many integrator states on the CPU. On the GPU we declare outer SoA to have all volume stack elements, but only allocate actually needed ones. The actually used volume stack size is passed as a pre-processor, which seems to be easiest and fastest for the GPU state copy. There seems to be no speed regression in the demo files on RTX6000. Note that scenes with high nested level of volume will now be slower but correct. Differential Revision: https://developer.blender.org/D12759
Diffstat (limited to 'intern/cycles/kernel/kernel_types.h')
-rw-r--r--intern/cycles/kernel/kernel_types.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 6107e1028ba..22dde3537eb 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -61,8 +61,6 @@ CCL_NAMESPACE_BEGIN
#define ID_NONE (0.0f)
#define PASS_UNUSED (~0)
-#define VOLUME_STACK_SIZE 4
-
/* Kernel features */
#define __SOBOL__
#define __DPDU__
@@ -608,6 +606,12 @@ typedef struct AttributeDescriptor {
# define MAX_CLOSURE __MAX_CLOSURE__
#endif
+#ifndef __MAX_VOLUME_STACK_SIZE__
+# define MAX_VOLUME_STACK_SIZE 32
+#else
+# define MAX_VOLUME_STACK_SIZE __MAX_VOLUME_STACK_SIZE__
+#endif
+
#define MAX_VOLUME_CLOSURE 8
/* This struct is the base class for all closures. The common members are
@@ -1223,7 +1227,7 @@ typedef struct KernelData {
uint kernel_features;
uint max_closures;
uint max_shaders;
- uint pad;
+ uint volume_stack_size;
KernelCamera cam;
KernelFilm film;