light: fix minor threading bug with `total_surflight_points` stat

needs to be protected by mutex
This commit is contained in:
Eric Wasylishen 2023-04-08 16:16:44 -06:00
parent c2a787f6a3
commit 098ce84d7b
1 changed files with 1 additions and 1 deletions

View File

@ -79,7 +79,6 @@ static void MakeSurfaceLight(const mbsp_t *bsp, const settings::worldspawn_keys
vector<qvec3f> points; vector<qvec3f> points;
winding.dice(cfg.surflightsubdivision.value(), winding.dice(cfg.surflightsubdivision.value(),
[&points, &facenormal](winding_t &w) { points.push_back(w.center() + facenormal); }); [&points, &facenormal](winding_t &w) { points.push_back(w.center() + facenormal); });
total_surflight_points += points.size();
// Calculate emit color and intensity... // Calculate emit color and intensity...
@ -141,6 +140,7 @@ static void MakeSurfaceLight(const mbsp_t *bsp, const settings::worldspawn_keys
// Store light... // Store light...
unique_lock<mutex> lck{surfacelights_lock}; unique_lock<mutex> lck{surfacelights_lock};
total_surflight_points += l.points.size();
surfacelights.push_back(l); surfacelights.push_back(l);
const int index = static_cast<int>(surfacelights.size()) - 1; const int index = static_cast<int>(surfacelights.size()) - 1;