diff options
-rw-r--r-- | Alc/backends/opensl.cpp | 2 | ||||
-rw-r--r-- | Alc/mixvoice.cpp | 2 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.cpp | 2 | ||||
-rw-r--r-- | OpenAL32/alBuffer.cpp | 12 | ||||
-rw-r--r-- | OpenAL32/alState.cpp | 2 | ||||
-rw-r--r-- | OpenAL32/event.cpp | 2 | ||||
-rw-r--r-- | common/atomic.h | 15 |
7 files changed, 11 insertions, 26 deletions
diff --git a/Alc/backends/opensl.cpp b/Alc/backends/opensl.cpp index d59ef5f3..9e8e5031 100644 --- a/Alc/backends/opensl.cpp +++ b/Alc/backends/opensl.cpp @@ -580,7 +580,7 @@ static ALCboolean ALCopenslPlayback_start(ALCopenslPlayback *self) if(SL_RESULT_SUCCESS != result) return ALC_FALSE; - ATOMIC_STORE_SEQ(&self->mKillNow, AL_FALSE); + self->mKillNow.store(AL_FALSE); if(althrd_create(&self->mThread, ALCopenslPlayback_mixerProc, self) != althrd_success) { ERR("Failed to start mixer thread\n"); diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp index 5a1a1d4d..86de61ee 100644 --- a/Alc/mixvoice.cpp +++ b/Alc/mixvoice.cpp @@ -706,7 +706,7 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize DataPosInt -= BufferListItem->max_samples; buffers_done += BufferListItem->num_buffers; - BufferListItem = ATOMIC_LOAD(&BufferListItem->next, almemory_order_relaxed); + BufferListItem = BufferListItem->next.load(std::memory_order_relaxed); if(!BufferListItem && !(BufferListItem=BufferLoopItem)) { isplaying = false; diff --git a/OpenAL32/alAuxEffectSlot.cpp b/OpenAL32/alAuxEffectSlot.cpp index e7991ff0..cf39292b 100644 --- a/OpenAL32/alAuxEffectSlot.cpp +++ b/OpenAL32/alAuxEffectSlot.cpp @@ -552,7 +552,7 @@ ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect if(props->State) props->State->DecRef(); props->State = nullptr; - props = ATOMIC_LOAD(&props->next, almemory_order_relaxed); + props = props->next.load(std::memory_order_relaxed); } return AL_NO_ERROR; diff --git a/OpenAL32/alBuffer.cpp b/OpenAL32/alBuffer.cpp index 3716ac28..1b50f075 100644 --- a/OpenAL32/alBuffer.cpp +++ b/OpenAL32/alBuffer.cpp @@ -235,7 +235,7 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei size, U NameFromUserFmtType(SrcType)); } - ALsizei unpackalign{ATOMIC_LOAD_SEQ(&ALBuf->UnpackAlign)}; + ALsizei unpackalign{ALBuf->UnpackAlign.load()}; ALsizei align{SanitizeAlignment(SrcType, unpackalign)}; if(UNLIKELY(align < 1)) SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid unpack alignment %d for %s samples", @@ -682,7 +682,7 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer, ALenum format, cons return; } - ALsizei unpack_align{ATOMIC_LOAD_SEQ(&albuf->UnpackAlign)}; + ALsizei unpack_align{albuf->UnpackAlign.load()}; ALsizei align{SanitizeAlignment(srctype, unpack_align)}; if(UNLIKELY(align < 1)) alSetError(context.get(), AL_INVALID_VALUE, "Invalid unpack alignment %d", unpack_align); @@ -854,14 +854,14 @@ AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum param, ALint value) if(UNLIKELY(value < 0)) alSetError(context.get(), AL_INVALID_VALUE, "Invalid unpack block alignment %d", value); else - ATOMIC_STORE_SEQ(&albuf->UnpackAlign, value); + albuf->UnpackAlign.store(value); break; case AL_PACK_BLOCK_ALIGNMENT_SOFT: if(UNLIKELY(value < 0)) alSetError(context.get(), AL_INVALID_VALUE, "Invalid pack block alignment %d", value); else - ATOMIC_STORE_SEQ(&albuf->PackAlign, value); + albuf->PackAlign.store(value); break; default: @@ -1036,11 +1036,11 @@ AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value break; case AL_UNPACK_BLOCK_ALIGNMENT_SOFT: - *value = ATOMIC_LOAD_SEQ(&albuf->UnpackAlign); + *value = albuf->UnpackAlign.load(); break; case AL_PACK_BLOCK_ALIGNMENT_SOFT: - *value = ATOMIC_LOAD_SEQ(&albuf->PackAlign); + *value = albuf->PackAlign.load(); break; default: diff --git a/OpenAL32/alState.cpp b/OpenAL32/alState.cpp index 95a4fd92..e2cd96d6 100644 --- a/OpenAL32/alState.cpp +++ b/OpenAL32/alState.cpp @@ -659,7 +659,7 @@ AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value) ContextRef context{GetContextRef()}; if(UNLIKELY(!context)) return; - if((ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed)&EventType_Deprecated)) + if((context->EnabledEvts.load(std::memory_order_relaxed)&EventType_Deprecated)) { static constexpr ALCchar msg[] = "alDopplerVelocity is deprecated in AL1.1, use alSpeedOfSound"; diff --git a/OpenAL32/event.cpp b/OpenAL32/event.cpp index a2c98928..0491c7c6 100644 --- a/OpenAL32/event.cpp +++ b/OpenAL32/event.cpp @@ -38,7 +38,7 @@ static int EventThread(ALCcontext *context) continue; } - ALbitfieldSOFT enabledevts{ATOMIC_LOAD(&context->EnabledEvts, almemory_order_acquire)}; + ALbitfieldSOFT enabledevts{context->EnabledEvts.load(std::memory_order_acquire)}; if(context->EventCb && (enabledevts&evt.EnumType) == evt.EnumType) context->EventCb(evt.u.user.type, evt.u.user.id, evt.u.user.param, (ALsizei)strlen(evt.u.user.msg), evt.u.user.msg, context->EventParam diff --git a/common/atomic.h b/common/atomic.h index 2b512653..e34f35bb 100644 --- a/common/atomic.h +++ b/common/atomic.h @@ -4,21 +4,6 @@ #include <atomic> -#define almemory_order std::memory_order -#define almemory_order_relaxed std::memory_order_relaxed -#define almemory_order_consume std::memory_order_consume -#define almemory_order_acquire std::memory_order_acquire -#define almemory_order_release std::memory_order_release -#define almemory_order_acq_rel std::memory_order_acq_rel -#define almemory_order_seq_cst std::memory_order_seq_cst - -#define ATOMIC_LOAD std::atomic_load_explicit -#define ATOMIC_STORE std::atomic_store_explicit - -#define ATOMIC_LOAD_SEQ(_val) ATOMIC_LOAD(_val, almemory_order_seq_cst) -#define ATOMIC_STORE_SEQ(_val, _newval) ATOMIC_STORE(_val, _newval, almemory_order_seq_cst) - - using RefCount = std::atomic<unsigned int>; inline void InitRef(RefCount *ptr, unsigned int value) |