From 3ed913f6dde4340325079a9c6d14e69c9731e11a Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 17 Dec 2021 04:14:39 -0800 Subject: [PATCH] Remove an unnecessary parameter --- al/source.cpp | 2 +- alc/context.cpp | 24 ++++++++++-------------- core/context.h | 2 +- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/al/source.cpp b/al/source.cpp index cf95f7a4..1bf0552a 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -521,7 +521,7 @@ VoiceChange *GetVoiceChanger(ALCcontext *ctx) VoiceChange *vchg{ctx->mVoiceChangeTail}; if UNLIKELY(vchg == ctx->mCurrentVoiceChange.load(std::memory_order_acquire)) { - ctx->allocVoiceChanges(1); + ctx->allocVoiceChanges(); vchg = ctx->mVoiceChangeTail; } diff --git a/alc/context.cpp b/alc/context.cpp index 297d24a6..0b6bd022 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -171,21 +171,17 @@ ContextBase::~ContextBase() } } -void ContextBase::allocVoiceChanges(size_t addcount) +void ContextBase::allocVoiceChanges() { constexpr size_t clustersize{128}; - /* Convert element count to cluster count. */ - addcount = (addcount+(clustersize-1)) / clustersize; - while(addcount) - { - VoiceChangeCluster cluster{std::make_unique(clustersize)}; - for(size_t i{1};i < clustersize;++i) - cluster[i-1].mNext.store(std::addressof(cluster[i]), std::memory_order_relaxed); - cluster[clustersize-1].mNext.store(mVoiceChangeTail, std::memory_order_relaxed); - mVoiceChangeClusters.emplace_back(std::move(cluster)); - mVoiceChangeTail = mVoiceChangeClusters.back().get(); - --addcount; - } + + VoiceChangeCluster cluster{std::make_unique(clustersize)}; + for(size_t i{1};i < clustersize;++i) + cluster[i-1].mNext.store(std::addressof(cluster[i]), std::memory_order_relaxed); + cluster[clustersize-1].mNext.store(mVoiceChangeTail, std::memory_order_relaxed); + + mVoiceChangeClusters.emplace_back(std::move(cluster)); + mVoiceChangeTail = mVoiceChangeClusters.back().get(); } void ContextBase::allocVoiceProps() @@ -287,7 +283,7 @@ void ALCcontext::init() } mActiveAuxSlots.store(auxslots, std::memory_order_relaxed); - allocVoiceChanges(1); + allocVoiceChanges(); { VoiceChange *cur{mVoiceChangeTail}; while(VoiceChange *next{cur->mNext.load(std::memory_order_relaxed)}) diff --git a/core/context.h b/core/context.h index 0e531db0..6bdf5db9 100644 --- a/core/context.h +++ b/core/context.h @@ -121,7 +121,7 @@ struct ContextBase { VoiceChange *mVoiceChangeTail{}; std::atomic mCurrentVoiceChange{}; - void allocVoiceChanges(size_t addcount); + void allocVoiceChanges(); void allocVoiceProps();