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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-26 15:05:22 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-26 15:05:22 +0400
commit58ee2bdfc0b45335a8e3e4f552749a111e926c69 (patch)
treef49d5a7154003328abf1b8e47416e3c04db27f49 /intern/cycles/kernel/kernel_light.h
parenta91814e94dbd021cf91c164ce10ff20d115dd74d (diff)
Fix: cycles light sampling crash, happens on rare occasions due to float
rounding errors.
Diffstat (limited to 'intern/cycles/kernel/kernel_light.h')
-rw-r--r--intern/cycles/kernel/kernel_light.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h
index 2791b3abbb6..97ae2d3db87 100644
--- a/intern/cycles/kernel/kernel_light.h
+++ b/intern/cycles/kernel/kernel_light.h
@@ -350,10 +350,9 @@ __device int light_distribution_sample(KernelGlobals *kg, float randt)
}
}
- first = max(0, first-1);
- kernel_assert(first >= 0 && first < kernel_data.integrator.num_distribution);
-
- return first;
+ /* clamping should not be needed but float rounding errors seem to
+ * make this fail on rare occasions */
+ return clamp(first-1, 0, kernel_data.integrator.num_distribution-1);
}
/* Generic Light */