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:
authorMai Lavelle <mai.lavelle@gmail.com>2017-04-26 17:22:48 +0300
committerMai Lavelle <mai.lavelle@gmail.com>2017-04-26 17:48:15 +0300
commit7c1263c1ee3f4ff18be3a5aab4e02818a361db50 (patch)
tree976d69574e7ec193e2724dce63c84c1240882749 /intern/cycles/device/device_split_kernel.cpp
parent90b25392489e884278aead215884e4a85401a926 (diff)
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.
Diffstat (limited to 'intern/cycles/device/device_split_kernel.cpp')
-rw-r--r--intern/cycles/device/device_split_kernel.cpp12
1 files changed, 10 insertions, 2 deletions
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;
}
}