diff options
Diffstat (limited to 'al')
-rw-r--r-- | al/auxeffectslot.cpp | 22 | ||||
-rw-r--r-- | al/auxeffectslot.h | 2 | ||||
-rw-r--r-- | al/listener.cpp | 14 | ||||
-rw-r--r-- | al/source.cpp | 4 | ||||
-rw-r--r-- | al/source.h | 2 | ||||
-rw-r--r-- | al/state.cpp | 14 |
6 files changed, 29 insertions, 29 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp index ad974483..50c5cda6 100644 --- a/al/auxeffectslot.cpp +++ b/al/auxeffectslot.cpp @@ -310,11 +310,12 @@ void FreeEffectSlot(ALCcontext *context, ALeffectslot *slot) inline void UpdateProps(ALeffectslot *slot, ALCcontext *context) { - if(!context->mDeferUpdates.load(std::memory_order_acquire) - && slot->mState == SlotState::Playing) + if(!context->mDeferUpdates && slot->mState == SlotState::Playing) + { slot->updateProps(context); - else - slot->mPropsDirty.set(std::memory_order_release); + return; + } + slot->mPropsDirty = true; } } // namespace @@ -466,7 +467,7 @@ START_API_FUNC if(slot->mState == SlotState::Playing) return; - slot->mPropsDirty.test_and_clear(std::memory_order_acq_rel); + slot->mPropsDirty = false; slot->updateProps(context.get()); AddActiveEffectSlots({&slot, 1}, context.get()); @@ -497,7 +498,7 @@ START_API_FUNC if(slot->mState != SlotState::Playing) { - slot->mPropsDirty.test_and_clear(std::memory_order_acq_rel); + slot->mPropsDirty = false; slot->updateProps(context.get()); } slots[i] = slot; @@ -598,7 +599,7 @@ START_API_FUNC } if UNLIKELY(slot->mState == SlotState::Initial) { - slot->mPropsDirty.test_and_clear(std::memory_order_acq_rel); + slot->mPropsDirty = false; slot->updateProps(context.get()); AddActiveEffectSlots({&slot, 1}, context.get()); @@ -913,8 +914,6 @@ END_API_FUNC ALeffectslot::ALeffectslot() { - mPropsDirty.test_and_clear(std::memory_order_relaxed); - EffectStateFactory *factory{getFactoryByType(EffectSlotType::None)}; assert(factory != nullptr); @@ -1033,8 +1032,7 @@ void UpdateAllEffectSlotProps(ALCcontext *context) ALeffectslot *slot{sublist.EffectSlots + idx}; usemask &= ~(1_u64 << idx); - if(slot->mState != SlotState::Stopped - && slot->mPropsDirty.test_and_clear(std::memory_order_acq_rel)) + if(slot->mState != SlotState::Stopped && std::exchange(slot->mPropsDirty, false)) slot->updateProps(context); } } @@ -1715,7 +1713,7 @@ void ALeffectslot::eax_set_effect_slot_effect(EaxEffect &effect) if (mState == SlotState::Initial) { - mPropsDirty.test_and_clear(std::memory_order_acq_rel); + mPropsDirty = false; updateProps(eax_al_context_); auto effect_slot_ptr = this; diff --git a/al/auxeffectslot.h b/al/auxeffectslot.h index 30f9caac..d845b2b4 100644 --- a/al/auxeffectslot.h +++ b/al/auxeffectslot.h @@ -48,7 +48,7 @@ struct ALeffectslot { al::intrusive_ptr<EffectState> State; } Effect; - al::atomic_invflag mPropsDirty; + bool mPropsDirty{true}; SlotState mState{SlotState::Initial}; diff --git a/al/listener.cpp b/al/listener.cpp index a260c93c..9484d9b1 100644 --- a/al/listener.cpp +++ b/al/listener.cpp @@ -40,16 +40,18 @@ namespace { inline void UpdateProps(ALCcontext *context) { - if(!context->mDeferUpdates.load(std::memory_order_acquire)) + if(!context->mDeferUpdates) + { UpdateContextProps(context); - else - context->mPropsDirty.set(std::memory_order_release); + return; + } + context->mPropsDirty = true; } #ifdef ALSOFT_EAX inline void CommitAndUpdateProps(ALCcontext *context) { - if(!context->mDeferUpdates.load(std::memory_order_acquire)) + if(!context->mDeferUpdates) { if(context->has_eax()) { @@ -62,9 +64,9 @@ inline void CommitAndUpdateProps(ALCcontext *context) } UpdateContextProps(context); context->mHoldUpdates.store(false, std::memory_order_release); + return; } - else - context->mPropsDirty.set(std::memory_order_release); + context->mPropsDirty = true; } #else diff --git a/al/source.cpp b/al/source.cpp index 08b8246b..e363b0da 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -1130,7 +1130,7 @@ void SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, const void UpdateSourceProps(ALsource *source, ALCcontext *context) { - if(!context->mDeferUpdates.load(std::memory_order_acquire)) + if(!context->mDeferUpdates) { if(Voice *voice{GetSourceVoice(source, context)}) { @@ -1143,7 +1143,7 @@ void UpdateSourceProps(ALsource *source, ALCcontext *context) #ifdef ALSOFT_EAX void CommitAndUpdateSourceProps(ALsource *source, ALCcontext *context) { - if(!context->mDeferUpdates.load(std::memory_order_acquire)) + if(!context->mDeferUpdates) { if(source->eax_is_initialized()) source->eax_commit(); diff --git a/al/source.h b/al/source.h index 27e012af..24096a64 100644 --- a/al/source.h +++ b/al/source.h @@ -187,7 +187,7 @@ struct ALsource { /** Source Buffer Queue head. */ al::deque<ALbufferQueueItem> mQueue; - bool mPropsDirty{false}; + bool mPropsDirty{true}; /* Index into the context's Voices array. Lazily updated, only checked and * reset when looking up the voice. diff --git a/al/state.cpp b/al/state.cpp index 7d69e962..07fd1314 100644 --- a/al/state.cpp +++ b/al/state.cpp @@ -147,10 +147,10 @@ START_API_FUNC END_API_FUNC #define DO_UPDATEPROPS() do { \ - if(!context->mDeferUpdates.load(std::memory_order_acquire)) \ + if(!context->mDeferUpdates) \ UpdateContextProps(context.get()); \ else \ - context->mPropsDirty.set(std::memory_order_release); \ + context->mPropsDirty = true; \ } while(0) @@ -263,7 +263,7 @@ START_API_FUNC break; case AL_DEFERRED_UPDATES_SOFT: - if(context->mDeferUpdates.load(std::memory_order_acquire)) + if(context->mDeferUpdates) value = AL_TRUE; break; @@ -316,7 +316,7 @@ START_API_FUNC break; case AL_DEFERRED_UPDATES_SOFT: - if(context->mDeferUpdates.load(std::memory_order_acquire)) + if(context->mDeferUpdates) value = static_cast<ALdouble>(AL_TRUE); break; @@ -367,7 +367,7 @@ START_API_FUNC break; case AL_DEFERRED_UPDATES_SOFT: - if(context->mDeferUpdates.load(std::memory_order_acquire)) + if(context->mDeferUpdates) value = static_cast<ALfloat>(AL_TRUE); break; @@ -418,7 +418,7 @@ START_API_FUNC break; case AL_DEFERRED_UPDATES_SOFT: - if(context->mDeferUpdates.load(std::memory_order_acquire)) + if(context->mDeferUpdates) value = AL_TRUE; break; @@ -504,7 +504,7 @@ START_API_FUNC break; case AL_DEFERRED_UPDATES_SOFT: - if(context->mDeferUpdates.load(std::memory_order_acquire)) + if(context->mDeferUpdates) value = AL_TRUE; break; |