aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alSource.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-02-20 22:00:26 -0800
committerChris Robinson <[email protected]>2019-02-20 22:00:26 -0800
commit3966665ca34ff4641df54b046a181f3a3d4991f6 (patch)
tree8fdcddecad69d64dd424b2b62892cc4c1c2bd359 /OpenAL32/alSource.cpp
parentc43381d811f436187b99c51951365c33fc735dc5 (diff)
Store effect slots in groups of 64
Now that their wet buffers are allocated dynamically, the ALeffectslot object itself is rather small.
Diffstat (limited to 'OpenAL32/alSource.cpp')
-rw-r--r--OpenAL32/alSource.cpp11
1 files changed, 8 insertions, 3 deletions
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;
}