Fix dirtyChunksLock scope in updateDirtyChunks

Move unique_lock declaration before the FRAME_PROFILE_SCOPE block so it remains in scope for the unlock() calls in the #if/#else branches below.
This commit is contained in:
MatthewBeshay 2026-03-30 19:12:22 +11:00
parent f1df21590b
commit 57e4bdd973

View file

@ -1698,6 +1698,7 @@ bool LevelRenderer::updateDirtyChunks() {
ClipChunk* nearChunk = nullptr; // Nearest chunk that is dirty
int veryNearCount = 0;
int minDistSq = 0x7fffffff; // Distances to this chunk
std::unique_lock<std::mutex> dirtyChunksLock(m_csDirtyChunks);
// Set a flag if we should only rebuild existing chunks, not create anything
// new
@ -1716,7 +1717,6 @@ bool LevelRenderer::updateDirtyChunks() {
PIXAddNamedCounter(((float)memAlloc) / (1024.0f * 1024.0f),
"Command buffer allocations");
bool onlyRebuild = (memAlloc >= MAX_COMMANDBUFFER_ALLOCATIONS);
std::unique_lock<std::mutex> dirtyChunksLock(m_csDirtyChunks);
// Move any dirty chunks stored in the lock free stack into global flags
int index = 0;