diff options
author | Chris Robinson <[email protected]> | 2017-03-12 19:27:51 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-03-12 19:27:51 -0700 |
commit | cdf63b553f90a5a4b3af9902f9d94f089c8cf2e3 (patch) | |
tree | 94e75adb1cf78abe107229a446399a2113db9a62 /OpenAL32/alSource.c | |
parent | 1e7c0b4646042eaaf19d726b74a2d04a0c3d2288 (diff) |
Avoid doing sequential load for the source state
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r-- | OpenAL32/alSource.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index a36231b5..c4cdf16e 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -138,9 +138,9 @@ static inline ALvoice *GetSourceVoice(const ALsource *source, const ALCcontext * return NULL; } -static inline bool IsPlayingOrPausedSeq(const ALsource *source) +static inline bool IsPlayingOrPaused(ALsource *source) { - ALenum state = ATOMIC_LOAD_SEQ(&source->state); + ALenum state = ATOMIC_LOAD(&source->state, almemory_order_acquire); return state == AL_PLAYING || state == AL_PAUSED; } @@ -157,10 +157,10 @@ static ALenum GetSourceState(ALsource *source, ALvoice *voice) return ATOMIC_LOAD(&source->state, almemory_order_acquire); } -static inline bool SourceShouldUpdate(const ALsource *source, const ALCcontext *context) +static inline bool SourceShouldUpdate(ALsource *source, ALCcontext *context) { - return IsPlayingOrPausedSeq(source) && - !ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire); + return !ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) && + IsPlayingOrPaused(source); } static ALint FloatValsByProp(ALenum prop) @@ -543,8 +543,7 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p Source->OffsetType = prop; Source->Offset = *values; - if(!ATOMIC_LOAD(&Context->DeferUpdates, almemory_order_acquire) && - IsPlayingOrPausedSeq(Source)) + if(SourceShouldUpdate(Source, Context)) { ALvoice *voice; @@ -750,8 +749,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p Source->OffsetType = prop; Source->Offset = *values; - if(!ATOMIC_LOAD(&Context->DeferUpdates, almemory_order_acquire) && - IsPlayingOrPausedSeq(Source)) + if(SourceShouldUpdate(Source, Context)) { ALvoice *voice; @@ -874,7 +872,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p } UnlockFiltersRead(device); - if(slot != Source->Send[values[1]].Slot && IsPlayingOrPausedSeq(Source)) + if(slot != Source->Send[values[1]].Slot && IsPlayingOrPaused(Source)) { /* Add refcount on the new slot, and release the previous slot */ if(slot) IncrementRef(&slot->ref); |