Commit: ef11be0e77461a7b5d657c365bac2b7746ca47bf
Author: Sergey Sharybin
Date: Wed Feb 18 01:57:56 2015 +0500
Branches: master
https://developer.blender.org/rBef11be0e77461a7b5d657c365bac2b7746ca47bf
Cycles: Avoid over-allocation in decouple ray marching
It could have happened with really long rays and small steps.
Step size will be adjusted to the clamped number of steps in order
to preserve render result compatibility as much as possible.
We should probably reformulate this a bit, so it will give the
same looking results without step tweaks. But this new behavior
should already be much better that it was before.
===================================================================
M intern/cycles/kernel/kernel_volume.h
===================================================================
diff --git a/intern/cycles/kernel/kernel_volume.h
b/intern/cycles/kernel/kernel_volume.h
index 9d6c233..8e67ad5 100644
--- a/intern/cycles/kernel/kernel_volume.h
+++ b/intern/cycles/kernel/kernel_volume.h
@@ -623,13 +623,16 @@ ccl_device void
kernel_volume_decoupled_record(KernelGlobals *kg, PathState *sta
float step_size, random_jitter_offset;
if(heterogeneous) {
- max_steps = kernel_data.integrator.volume_max_steps;
+ const int global_max_steps =
kernel_data.integrator.volume_max_steps;
step_size = kernel_data.integrator.volume_step_size;
- random_jitter_offset = lcg_step_float(&state->rng_congruential)
* step_size;
-
/* compute exact steps in advance for malloc */
max_steps = max((int)ceilf(ray->t/step_size), 1);
+ if (max_steps > global_max_steps) {
+ max_steps = global_max_steps;
+ step_size = ray->t / (float)max_steps;
+ }
segment->steps =
(VolumeStep*)malloc(sizeof(VolumeStep)*max_steps);
+ random_jitter_offset = lcg_step_float(&state->rng_congruential)
* step_size;
}
else {
max_steps = 1;
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs