forked from bartvdbraak/blender
Fix: cycles light sampling crash, happens on rare occasions due to float
rounding errors.
This commit is contained in:
parent
a91814e94d
commit
58ee2bdfc0
@ -49,7 +49,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', '
|
|||||||
|
|
||||||
# optimized kernel
|
# optimized kernel
|
||||||
if env['WITH_BF_RAYOPTIMIZATION']:
|
if env['WITH_BF_RAYOPTIMIZATION']:
|
||||||
optim_cxxflags = []
|
optim_cxxflags = Split(env['CXXFLAGS'])
|
||||||
|
|
||||||
if env['OURPLATFORM'] == 'win32-vc':
|
if env['OURPLATFORM'] == 'win32-vc':
|
||||||
optim_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
|
optim_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
|
||||||
|
@ -350,10 +350,9 @@ __device int light_distribution_sample(KernelGlobals *kg, float randt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
first = max(0, first-1);
|
/* clamping should not be needed but float rounding errors seem to
|
||||||
kernel_assert(first >= 0 && first < kernel_data.integrator.num_distribution);
|
* make this fail on rare occasions */
|
||||||
|
return clamp(first-1, 0, kernel_data.integrator.num_distribution-1);
|
||||||
return first;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generic Light */
|
/* Generic Light */
|
||||||
|
Loading…
Reference in New Issue
Block a user