Fixed undetected compiler error due to gcc accepting variable-length arrays

This commit is contained in:
Fernando García Liñán 2019-06-11 23:05:09 +02:00
parent b22a8debf2
commit ab8b1d39bd

View File

@ -253,12 +253,12 @@ ClusteredShading::update(const SGLightList &light_list)
// Again, avoid the unnecessary threading overhead
threadFunc(0);
} else {
std::thread light_threads[_num_threads];
std::vector<std::thread> threads;
threads.reserve(_num_threads);
for (int i = 0; i < _num_threads; ++i)
light_threads[i] = std::thread(&ClusteredShading::threadFunc, this, i);
threads.emplace_back(&ClusteredShading::threadFunc, this, i);
for (int i = 0; i < _num_threads; ++i)
light_threads[i].join();
for (auto &t : threads) t.join();
}
// Force upload of the image data