Commit: 7c1263c1ee3f4ff18be3a5aab4e02818a361db50 Author: Mai Lavelle Date: Wed Apr 26 10:22:48 2017 -0400 Branches: master https://developer.blender.org/rB7c1263c1ee3f4ff18be3a5aab4e02818a361db50
Cycles: Allow samples to finish in split kernel to avoid artifacts when canceling Previously canceling a render done by the split kernel could cause artifacts such as very bright or dark tiles. This was caused by unfinished samples being included in the output buffer. To avoid this we now wait till all the currently rendering samples have finished, up to a limit of twice the expected time for them to finish (currently this is no more than 20 seconds, but usually its much less). If samples still haven't finished by then we stop anyways in case there's an endless loop occurring. =================================================================== M intern/cycles/device/device_split_kernel.cpp =================================================================== diff --git a/intern/cycles/device/device_split_kernel.cpp b/intern/cycles/device/device_split_kernel.cpp index 981ec74fe56..71d52bb8097 100644 --- a/intern/cycles/device/device_split_kernel.cpp +++ b/intern/cycles/device/device_split_kernel.cpp @@ -227,6 +227,7 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task, ENQUEUE_SPLIT_KERNEL(path_init, global_size, local_size); bool activeRaysAvailable = true; + double cancel_time = DBL_MAX; while(activeRaysAvailable) { /* Do path-iteration in host [Enqueue Path-iteration kernels. */ @@ -247,7 +248,14 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task, ENQUEUE_SPLIT_KERNEL(queue_enqueue, global_size, local_size); ENQUEUE_SPLIT_KERNEL(buffer_update, global_size, local_size); - if(task->get_cancel()) { + if(task->get_cancel() && cancel_time == DBL_MAX) { + /* Wait up to twice as many seconds for current samples to finish + * to avoid artifacts in render result from ending too soon. + */ + cancel_time = time_dt() + 2.0 * time_multiplier; + } + + if(time_dt() > cancel_time) { return true; } } @@ -271,7 +279,7 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task, } } - if(task->get_cancel()) { + if(time_dt() > cancel_time) { return true; } } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs