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:
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
parenta91814e94dbd021cf91c164ce10ff20d115dd74d (diff)
Fix: cycles light sampling crash, happens on rare occasions due to float
rounding errors.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/SConscript2
-rw-r--r--intern/cycles/kernel/kernel_light.h7
2 files changed, 4 insertions, 5 deletions
diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript
index 1a127e364fe..a0e2650ddc6 100644
--- a/intern/cycles/SConscript
+++ b/intern/cycles/SConscript
@@ -49,7 +49,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', '
# optimized kernel
if env['WITH_BF_RAYOPTIMIZATION']:
- optim_cxxflags = []
+ optim_cxxflags = Split(env['CXXFLAGS'])
if env['OURPLATFORM'] == 'win32-vc':
optim_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
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 */