From 3966665ca34ff4641df54b046a181f3a3d4991f6 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 20 Feb 2019 22:00:26 -0800 Subject: Store effect slots in groups of 64 Now that their wet buffers are allocated dynamically, the ALeffectslot object itself is rather small. --- OpenAL32/alSource.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'OpenAL32/alSource.cpp') diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp index dd418a58..cf466c32 100644 --- a/OpenAL32/alSource.cpp +++ b/OpenAL32/alSource.cpp @@ -582,10 +582,15 @@ inline ALfilter *LookupFilter(ALCdevice *device, ALuint id) noexcept inline ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) noexcept { - --id; - if(UNLIKELY(id >= context->EffectSlotList.size())) + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= context->EffectSlotList.size())) + return nullptr; + EffectSlotSubList &sublist{context->EffectSlotList[lidx]}; + if(UNLIKELY(sublist.FreeMask & (1_u64 << slidx))) return nullptr; - return context->EffectSlotList[id].get(); + return sublist.EffectSlots + slidx; } -- cgit v1.2.3