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
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey@blender.org>2021-10-08 12:17:42 +0300
committerSergey Sharybin <sergey@blender.org>2021-10-08 16:44:03 +0300
commitf01c4f27f978d3c70ca01515e338d7edd6e59b32 (patch)
treea97e6a62fa67acdf7ffa1c1f0b9fd0ea90a5fcc6 /intern
parentff9587d28eab0339e8341673ed90db29a2932a95 (diff)
Fix Cycles speed regression after dynamic volume stack change
Only copy required part of volume stack instead of entire stack. Solves time regression introduced by D12759 and avoids need in implementing volume stack calculation to exactly match what the path tracing will do (as well as potentially makes scenes with a lot of volumes ans a tiny bit of deeply nested ones render faster). Still need to look into memory aspect of the regression, but that is for separate patch. Ref T92014 Maniphest Tasks: T92014 Differential Revision: https://developer.blender.org/D12790
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/kernel/integrator/integrator_state_util.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/intern/cycles/kernel/integrator/integrator_state_util.h b/intern/cycles/kernel/integrator/integrator_state_util.h
index 453ec49c7b0..01d596b690a 100644
--- a/intern/cycles/kernel/integrator/integrator_state_util.h
+++ b/intern/cycles/kernel/integrator/integrator_state_util.h
@@ -155,12 +155,17 @@ ccl_device_forceinline void integrator_state_read_shadow_isect(INTEGRATOR_STATE_
ccl_device_forceinline void integrator_state_copy_volume_stack_to_shadow(INTEGRATOR_STATE_ARGS)
{
if (kernel_data.kernel_features & KERNEL_FEATURE_VOLUME) {
- for (int i = 0; i < kernel_data.volume_stack_size; i++) {
- INTEGRATOR_STATE_ARRAY_WRITE(shadow_volume_stack, i, object) = INTEGRATOR_STATE_ARRAY(
- volume_stack, i, object);
- INTEGRATOR_STATE_ARRAY_WRITE(shadow_volume_stack, i, shader) = INTEGRATOR_STATE_ARRAY(
- volume_stack, i, shader);
- }
+ int index = 0;
+ int shader;
+ do {
+ shader = INTEGRATOR_STATE_ARRAY(volume_stack, index, shader);
+
+ INTEGRATOR_STATE_ARRAY_WRITE(shadow_volume_stack, index, object) = INTEGRATOR_STATE_ARRAY(
+ volume_stack, index, object);
+ INTEGRATOR_STATE_ARRAY_WRITE(shadow_volume_stack, index, shader) = shader;
+
+ ++index;
+ } while (shader != OBJECT_NONE);
}
}