aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-08-25 06:17:36 -0700
committerChris Robinson <[email protected]>2016-08-25 06:17:36 -0700
commita16739f7651afb7653387b1e79b2985058d76e90 (patch)
tree0e0071564da36bb70293f36541a295682e13868f /Alc
parent4e4e597fa54cc3498ae28bea9c2684e1fee05389 (diff)
Properly defer effect slot changes
Note that this now also causes all playing sources to update when an effect slot is updated. This is a bit wasteful, as it should only need to re-update sources that are using the effect slot (and only when a relevant property is changed), but it's good enough. Especially with deferring since all playing sources are going to get updated on the process call anyway.
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c1
-rw-r--r--Alc/ALu.c8
2 files changed, 6 insertions, 3 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 15614dd1..b95c90f8 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1611,6 +1611,7 @@ void ALCcontext_ProcessUpdates(ALCcontext *context)
althrd_yield();
UpdateListenerProps(context);
+ UpdateAllEffectSlotProps(context);
LockUIntMapRead(&context->SourceMap);
V0(device->Backend,lock)();
diff --git a/Alc/ALu.c b/Alc/ALu.c
index d2aa381c..eafb082c 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -295,14 +295,14 @@ static ALboolean CalcListenerParams(ALCcontext *Context)
return AL_TRUE;
}
-static void CalcEffectSlotParams(ALeffectslot *slot, ALCdevice *device)
+static ALboolean CalcEffectSlotParams(ALeffectslot *slot, ALCdevice *device)
{
struct ALeffectslotProps *first;
struct ALeffectslotProps *props;
ALeffectState *state;
props = ATOMIC_EXCHANGE(struct ALeffectslotProps*, &slot->Update, NULL, almemory_order_acq_rel);
- if(!props) return;
+ if(!props) return AL_FALSE;
slot->Params.Gain = ATOMIC_LOAD(&props->Gain, almemory_order_relaxed);
slot->Params.AuxSendAuto = ATOMIC_LOAD(&props->AuxSendAuto, almemory_order_relaxed);
@@ -339,6 +339,8 @@ static void CalcEffectSlotParams(ALeffectslot *slot, ALCdevice *device)
ATOMIC_STORE(&props->next, first, almemory_order_relaxed);
} while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALeffectslotProps*,
&slot->FreeList, &first, props) == 0);
+
+ return AL_TRUE;
}
@@ -1339,7 +1341,7 @@ static void UpdateContextSources(ALCcontext *ctx, ALeffectslot *slot)
ALboolean force = CalcListenerParams(ctx);
while(slot)
{
- CalcEffectSlotParams(slot, ctx->Device);
+ force |= CalcEffectSlotParams(slot, ctx->Device);
slot = ATOMIC_LOAD(&slot->next, almemory_order_relaxed);
}