Cycles: Check ray state properly to avoid endless loop
authorMai Lavelle <mai.lavelle@gmail.com>
Tue, 28 Mar 2017 06:28:36 +0000 (02:28 -0400)
committerMai Lavelle <mai.lavelle@gmail.com>
Fri, 7 Apr 2017 10:06:08 +0000 (06:06 -0400)
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

index ae462a560b71b7f5accbc57098188b514256b7bd..30e7a58281c87030a26cee6a753a6910ae132449 100644 (file)
@@ -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;