From d66ffaebef924dcfa1e5396852166760c07f0342 Mon Sep 17 00:00:00 2001 From: Mai Lavelle Date: Tue, 28 Mar 2017 02:28:36 -0400 Subject: [PATCH] Cycles: Check ray state properly to avoid endless loop The state mask wasnt applied before comparison giving false results. It shouldnt really happen that a ray state contains any flags that need to be masked away, but if it does happen its better to not get stuck. --- intern/cycles/device/device_split_kernel.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/intern/cycles/device/device_split_kernel.cpp b/intern/cycles/device/device_split_kernel.cpp index ae462a560b7..30e7a58281c 100644 --- a/intern/cycles/device/device_split_kernel.cpp +++ b/intern/cycles/device/device_split_kernel.cpp @@ -256,10 +256,8 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task, activeRaysAvailable = false; for(int rayStateIter = 0; rayStateIter < global_size[0] * global_size[1]; ++rayStateIter) { - int8_t state = ray_state.get_data()[rayStateIter]; - - if(state != RAY_INACTIVE) { - if(state == RAY_INVALID) { + if(!IS_STATE(ray_state.get_data(), rayStateIter, RAY_INACTIVE)) { + if(IS_STATE(ray_state.get_data(), rayStateIter, RAY_INVALID)) { /* Something went wrong, abort to avoid looping endlessly. */ device->set_error("Split kernel error: invalid ray state"); return false;