[Bf-blender-cvs] [f01c4f27f97] master: Fix Cycles speed regression after dynamic volume stack change
Sergey Sharybin
noreply at git.blender.org
Fri Oct 8 15:44:07 CEST 2021
Commit: f01c4f27f978d3c70ca01515e338d7edd6e59b32
Author: Sergey Sharybin
Date: Fri Oct 8 11:17:42 2021 +0200
Branches: master
https://developer.blender.org/rBf01c4f27f978d3c70ca01515e338d7edd6e59b32
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
===================================================================
M intern/cycles/kernel/integrator/integrator_state_util.h
===================================================================
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);
}
}
More information about the Bf-blender-cvs
mailing list