diff options
-rw-r--r-- | intern/cycles/integrator/work_tile_scheduler.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/intern/cycles/integrator/work_tile_scheduler.cpp b/intern/cycles/integrator/work_tile_scheduler.cpp index e6ada2f46ee..234b1fae915 100644 --- a/intern/cycles/integrator/work_tile_scheduler.cpp +++ b/intern/cycles/integrator/work_tile_scheduler.cpp @@ -88,7 +88,7 @@ bool WorkTileScheduler::get_work(KernelWorkTile *work_tile_, const int max_work_ DCHECK_NE(max_num_path_states_, 0); - const int work_index = atomic_fetch_and_add_int32(&next_work_index_, 1); + const int work_index = next_work_index_++; if (work_index >= total_work_size_) { return false; } @@ -121,12 +121,8 @@ bool WorkTileScheduler::get_work(KernelWorkTile *work_tile_, const int max_work_ if (max_work_size && tile_work_size > max_work_size) { /* The work did not fit into the requested limit of the work size. Unschedule the tile, - * allowing others (or ourselves later one) to pick it up. - * - * TODO: Such temporary decrement is not ideal, since it might lead to situation when another - * device sees there is nothing to be done, finishing its work and leaving all work to be - * done by us. */ - atomic_fetch_and_add_int32(&next_work_index_, -1); + * so it can be picked up again later. */ + next_work_index_--; return false; } |