From 99737469e2678a6169462c8488b6f6080c7857b6 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 11 Sep 2018 18:39:50 -0700 Subject: [PATCH] Ensure the max reverb update size is a multiple of 4 It's not an issue for the final mix, but if one loop has an unaligned count, the next loop will have unaligned input and output buffer targets which can crash the SSE mixers. --- Alc/effects/reverb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 2a6aea35..a32b1de4 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -948,9 +948,11 @@ static ALvoid ALreverbState_update(ALreverbState *State, const ALCcontext *Conte props->Reverb.ReflectionsGain*gain, props->Reverb.LateReverbGain*gain, State); - /* Calculate the max update size from the smallest relevant delay. */ + /* Calculate the max update size from the smallest relevant delay, ensuring + * the update size is a multiple of 4 for SIMD. + */ State->MaxUpdate[1] = mini(MAX_UPDATE_SAMPLES, - mini(State->Early.Offset[0][1], State->Late.Offset[0][1]) + mini(State->Early.Offset[0][1], State->Late.Offset[0][1])&~3 ); /* Determine if delay-line cross-fading is required. TODO: Add some fuzz