diff options
author | Chris Robinson <[email protected]> | 2024-01-03 13:16:09 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2024-01-03 13:16:09 -0800 |
commit | f8604758bc7cc43efa52a305a578ee9cf474f0d6 (patch) | |
tree | daba8befcbc45a7af52bb90a462aa7cb2daba1f5 /alc | |
parent | 2dacf2ddcc60b21a7ac67d8a020082d8f36d39dd (diff) |
Allocate effect slot property updates in clusters
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 23 | ||||
-rw-r--r-- | alc/alu.cpp | 2 |
2 files changed, 18 insertions, 7 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index cc25177d..e5f2c545 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1667,12 +1667,16 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) if(ALeffectslot *slot{context->mDefaultSlot.get()}) { - aluInitEffectPanning(slot->mSlot, context); + auto *slotbase = slot->mSlot; + aluInitEffectPanning(slotbase, context); + + if(auto *props = slotbase->Update.exchange(nullptr, std::memory_order_relaxed)) + AtomicReplaceHead(context->mFreeEffectSlotProps, props); EffectState *state{slot->Effect.State.get()}; state->mOutTarget = device->Dry.Buffer; state->deviceUpdate(device, slot->Buffer); - slot->updateProps(context); + slot->mPropsDirty = true; } if(EffectSlotArray *curarray{context->mActiveAuxSlots.load(std::memory_order_relaxed)}) @@ -1686,14 +1690,21 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) auto &slot = (*sublist.EffectSlots)[idx]; usemask &= ~(1_u64 << idx); - aluInitEffectPanning(slot.mSlot, context); + auto *slotbase = slot.mSlot; + aluInitEffectPanning(slotbase, context); + + if(auto *props = slotbase->Update.exchange(nullptr, std::memory_order_relaxed)) + AtomicReplaceHead(context->mFreeEffectSlotProps, props); EffectState *state{slot.Effect.State.get()}; state->mOutTarget = device->Dry.Buffer; state->deviceUpdate(device, slot.Buffer); - slot.updateProps(context); + slot.mPropsDirty = true; } } + /* Clear all effect slot props to let them get allocated again. */ + context->mEffectSlotPropClusters.clear(); + context->mFreeEffectSlotProps.store(nullptr, std::memory_order_relaxed); slotlock.unlock(); const uint num_sends{device->NumAuxSends}; @@ -1725,8 +1736,7 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) } } - auto voicelist = context->getVoicesSpan(); - for(Voice *voice : voicelist) + for(Voice *voice : context->getVoicesSpan()) { /* Clear extraneous property set sends. */ std::fill(std::begin(voice->mProps.Send)+num_sends, std::end(voice->mProps.Send), @@ -1758,6 +1768,7 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) context->mPropsDirty = false; UpdateContextProps(context); + UpdateAllEffectSlotProps(context); UpdateAllSourceProps(context); } mixer_mode.leave(); diff --git a/alc/alu.cpp b/alc/alu.cpp index 9e7a758e..59b5a551 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -498,7 +498,7 @@ bool CalcEffectSlotParams(EffectSlot *slot, EffectSlot **sorted_slots, ContextBa } } - AtomicReplaceHead(context->mFreeEffectslotProps, props); + AtomicReplaceHead(context->mFreeEffectSlotProps, props); EffectTarget output; if(EffectSlot *target{slot->Target}) |