diff options
author | Chris Robinson <[email protected]> | 2022-02-13 21:00:28 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-02-13 21:00:57 -0800 |
commit | 3e6d210767e432c780f892b2365f3644456b61b3 (patch) | |
tree | 2f914604efa03749d87d42a8257864bf42ad21ba /alc/context.cpp | |
parent | cdae6de6891f783fc5089ff82b9284f4a2c71e5b (diff) |
Avoid more unnecessary atomics
Diffstat (limited to 'alc/context.cpp')
-rw-r--r-- | alc/context.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/alc/context.cpp b/alc/context.cpp index 07dc76bf..c21bd1b9 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -114,7 +114,6 @@ void ALCcontext::setThreadContext(ALCcontext *context) noexcept ALCcontext::ALCcontext(al::intrusive_ptr<ALCdevice> device) : ContextBase{device.get()}, mALDevice{std::move(device)} { - mPropsDirty.test_and_clear(std::memory_order_relaxed); } ALCcontext::~ALCcontext() @@ -258,7 +257,7 @@ void ALCcontext::applyAllUpdates() /* busy-wait */ } - if(mPropsDirty.test_and_clear(std::memory_order_acq_rel)) + if(std::exchange(mPropsDirty, false)) UpdateContextProps(this); UpdateAllEffectSlotProps(this); UpdateAllSourceProps(this); @@ -908,13 +907,13 @@ void ALCcontext::eax_set_primary_fx_slot_id() void ALCcontext::eax_set_distance_factor() { mListener.mMetersPerUnit = eax_.context.flDistanceFactor; - mPropsDirty.set(std::memory_order_release); + mPropsDirty = true; } void ALCcontext::eax_set_air_absorbtion_hf() { mAirAbsorptionGainHF = eax_.context.flAirAbsorptionHF; - mPropsDirty.set(std::memory_order_release); + mPropsDirty = true; } void ALCcontext::eax_set_hf_reference() @@ -1285,14 +1284,14 @@ void ALCcontext::eax_set( if (!eax_call.is_deferred()) { eax_apply_deferred(); - if(!mDeferUpdates.load(std::memory_order_acquire)) + if(!mDeferUpdates) { mHoldUpdates.store(true, std::memory_order_release); while((mUpdateCount.load(std::memory_order_acquire)&1) != 0) { /* busy-wait */ } - if(mPropsDirty.test_and_clear(std::memory_order_acq_rel)) + if(std::exchange(mPropsDirty, false)) UpdateContextProps(this); UpdateAllSourceProps(this); |