mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-18 11:11:23 +00:00
restore openmp parallelization in display.cpp
This was removed in 4a997873485a6be4b511ea11241ec0349c8410fc
This commit is contained in:
parent
4bb55f4ab8
commit
34a7454696
@ -3082,22 +3082,50 @@ void display::invalidate_animations()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _OPENMP
|
||||||
BOOST_FOREACH(const unit & u, dc_->units()) {
|
BOOST_FOREACH(const unit & u, dc_->units()) {
|
||||||
u.anim_comp().refresh();
|
u.anim_comp().refresh();
|
||||||
}
|
}
|
||||||
BOOST_FOREACH(const unit* u, *fake_unit_man_) {
|
BOOST_FOREACH(const unit* u, *fake_unit_man_) {
|
||||||
u->anim_comp().refresh();
|
u->anim_comp().refresh();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
std::vector<const unit *> 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;
|
bool new_inval;
|
||||||
do {
|
do {
|
||||||
new_inval = false;
|
new_inval = false;
|
||||||
|
#ifndef _OPENMP
|
||||||
BOOST_FOREACH(const unit & u, dc_->units()) {
|
BOOST_FOREACH(const unit & u, dc_->units()) {
|
||||||
new_inval |= u.anim_comp().invalidate(*this);
|
new_inval |= u.anim_comp().invalidate(*this);
|
||||||
}
|
}
|
||||||
BOOST_FOREACH(const unit* u, *fake_unit_man_) {
|
BOOST_FOREACH(const unit* u, *fake_unit_man_) {
|
||||||
new_inval |= u->anim_comp().invalidate(*this);
|
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);
|
}while(new_inval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user