Remove an unnecessary parameter

This commit is contained in:
Chris Robinson 2021-12-17 04:14:39 -08:00
parent c9537abfb1
commit 3ed913f6dd
3 changed files with 12 additions and 16 deletions

View File

@ -521,7 +521,7 @@ VoiceChange *GetVoiceChanger(ALCcontext *ctx)
VoiceChange *vchg{ctx->mVoiceChangeTail}; VoiceChange *vchg{ctx->mVoiceChangeTail};
if UNLIKELY(vchg == ctx->mCurrentVoiceChange.load(std::memory_order_acquire)) if UNLIKELY(vchg == ctx->mCurrentVoiceChange.load(std::memory_order_acquire))
{ {
ctx->allocVoiceChanges(1); ctx->allocVoiceChanges();
vchg = ctx->mVoiceChangeTail; vchg = ctx->mVoiceChangeTail;
} }

View File

@ -171,21 +171,17 @@ ContextBase::~ContextBase()
} }
} }
void ContextBase::allocVoiceChanges(size_t addcount) void ContextBase::allocVoiceChanges()
{ {
constexpr size_t clustersize{128}; constexpr size_t clustersize{128};
/* Convert element count to cluster count. */
addcount = (addcount+(clustersize-1)) / clustersize;
while(addcount)
{
VoiceChangeCluster cluster{std::make_unique<VoiceChange[]>(clustersize)}; VoiceChangeCluster cluster{std::make_unique<VoiceChange[]>(clustersize)};
for(size_t i{1};i < clustersize;++i) for(size_t i{1};i < clustersize;++i)
cluster[i-1].mNext.store(std::addressof(cluster[i]), std::memory_order_relaxed); cluster[i-1].mNext.store(std::addressof(cluster[i]), std::memory_order_relaxed);
cluster[clustersize-1].mNext.store(mVoiceChangeTail, std::memory_order_relaxed); cluster[clustersize-1].mNext.store(mVoiceChangeTail, std::memory_order_relaxed);
mVoiceChangeClusters.emplace_back(std::move(cluster)); mVoiceChangeClusters.emplace_back(std::move(cluster));
mVoiceChangeTail = mVoiceChangeClusters.back().get(); mVoiceChangeTail = mVoiceChangeClusters.back().get();
--addcount;
}
} }
void ContextBase::allocVoiceProps() void ContextBase::allocVoiceProps()
@ -287,7 +283,7 @@ void ALCcontext::init()
} }
mActiveAuxSlots.store(auxslots, std::memory_order_relaxed); mActiveAuxSlots.store(auxslots, std::memory_order_relaxed);
allocVoiceChanges(1); allocVoiceChanges();
{ {
VoiceChange *cur{mVoiceChangeTail}; VoiceChange *cur{mVoiceChangeTail};
while(VoiceChange *next{cur->mNext.load(std::memory_order_relaxed)}) while(VoiceChange *next{cur->mNext.load(std::memory_order_relaxed)})

View File

@ -121,7 +121,7 @@ struct ContextBase {
VoiceChange *mVoiceChangeTail{}; VoiceChange *mVoiceChangeTail{};
std::atomic<VoiceChange*> mCurrentVoiceChange{}; std::atomic<VoiceChange*> mCurrentVoiceChange{};
void allocVoiceChanges(size_t addcount); void allocVoiceChanges();
void allocVoiceProps(); void allocVoiceProps();