Cycles: use safe compiler flags for OpenCL.

Using -cl-fast-relaxed-math assumes no NaN/Inf values in any expression.
This causes problems on overflow, division by zero, square root of negative number.
Comparisons with NaN or infinite value are affected as well.

This patch causes <2% slowdown on benchmark scenes.

Fix T50985: Rendering volume scatter with GPU OpenCL comes to an halt after a few seconds
This commit is contained in:
Hristo Gueorguiev
2017-04-25 20:10:51 +02:00
parent 9d26e32ea2
commit e91dc3a97c

View File

@@ -612,7 +612,7 @@ void OpenCLDeviceBase::shader(DeviceTask& task)
string OpenCLDeviceBase::kernel_build_options(const string *debug_src)
{
string build_options = "-cl-fast-relaxed-math ";
string build_options = "-cl-no-signed-zeros -cl-mad-enable ";
if(platform_name == "NVIDIA CUDA") {
build_options += "-D__KERNEL_OPENCL_NVIDIA__ "