From 34a745469667ef55ef5afd7ced080908be63c1fb Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Mon, 23 Jun 2014 12:55:01 -0400 Subject: [PATCH] restore openmp parallelization in display.cpp This was removed in 4a997873485a6be4b511ea11241ec0349c8410fc --- src/display.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/display.cpp b/src/display.cpp index 26607006fa9..d0b9af0ae9e 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -3082,22 +3082,50 @@ void display::invalidate_animations() } } +#ifndef _OPENMP BOOST_FOREACH(const unit & u, dc_->units()) { u.anim_comp().refresh(); } BOOST_FOREACH(const unit* u, *fake_unit_man_) { u->anim_comp().refresh(); } +#else + std::vector open_mp_list; + BOOST_FOREACH(const unit & u, dc_->units()) { + open_mp_list.push_back(&u); + } + BOOST_FOREACH(const unit* u, *fake_unit_man_) { + open_mp_list.push_back(u); + } + + #pragma omp parallel shared(chunks) + { + #pragma omp for + for(size_t i = 0; i < open_mp_list.size(); ++i) + open_mp_list[i]->anim_comp().refresh(); + } +} +#endif + bool new_inval; do { new_inval = false; +#ifndef _OPENMP BOOST_FOREACH(const unit & u, dc_->units()) { new_inval |= u.anim_comp().invalidate(*this); } BOOST_FOREACH(const unit* u, *fake_unit_man_) { new_inval |= u->anim_comp().invalidate(*this); } +#else + #pragma omp parallel shared(chunks) + { + #pragma omp for + for(size_t i = 0; i < open_mp_list.size(); ++i) + new_inval |= open_mp_list[i]->anim_comp().invalidate(*this); + } +#endif }while(new_inval); }