aboutsummaryrefslogtreecommitdiffstats
path: root/al
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-01-18 18:53:58 -0800
committerChris Robinson <[email protected]>2020-01-18 18:53:58 -0800
commit3904289af7d4693a04c02d8739118182de56df96 (patch)
tree6351ed0eb2f8931c003ea103ebcba9ce4b69cff2 /al
parent8a9eef70afea462c552f69c7564aa58bb0d4f6a5 (diff)
Only sort active effect slots as needed
Diffstat (limited to 'al')
-rw-r--r--al/auxeffectslot.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp
index 3c312c66..efc75aac 100644
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -114,11 +114,13 @@ void AddActiveEffectSlots(const ALuint *slotids, size_t count, ALCcontext *conte
delete curarray;
curarray = nullptr;
}
+ std::uninitialized_fill_n(newarray->end(), newcount, nullptr);
curarray = context->mActiveAuxSlots.exchange(newarray, std::memory_order_acq_rel);
ALCdevice *device{context->mDevice.get()};
while((device->MixCount.load(std::memory_order_acquire)&1))
std::this_thread::yield();
+ al::destroy_n(curarray->end(), curarray->size());
delete curarray;
}
@@ -150,11 +152,13 @@ void RemoveActiveEffectSlots(const ALuint *slotids, size_t count, ALCcontext *co
delete curarray;
curarray = nullptr;
}
+ std::uninitialized_fill_n(newarray->end(), newsize, nullptr);
curarray = context->mActiveAuxSlots.exchange(newarray, std::memory_order_acq_rel);
ALCdevice *device{context->mDevice.get()};
while((device->MixCount.load(std::memory_order_acquire)&1))
std::this_thread::yield();
+ al::destroy_n(curarray->end(), curarray->size());
delete curarray;
}