diff options
author | Chris Robinson <[email protected]> | 2023-05-01 14:46:26 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-05-01 14:46:26 -0700 |
commit | 89f67ad6f9878ecfb48b49ce0dd69b9ecb065d0b (patch) | |
tree | 0a20a4dcd51bde9620fbc44b5a2938e3e64bb0ab /al | |
parent | bd8c13d7883cb0a570f724885c7a55ad687dada6 (diff) |
Use a 64-bit value for tracking ID filters
Diffstat (limited to 'al')
-rw-r--r-- | al/debug.cpp | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/al/debug.cpp b/al/debug.cpp index 66cbc622..70c7c4db 100644 --- a/al/debug.cpp +++ b/al/debug.cpp @@ -224,29 +224,18 @@ FORCE_ALIGN void AL_APIENTRY alDebugMessageControlSOFT(ALenum source, ALenum typ std::lock_guard<std::mutex> _{context->mDebugCbLock}; if(count > 0) { - const uint filter{(1u<<srcIndices[0]) | (1u<<typeIndices[0])}; + const uint filterbase{(1u<<srcIndices[0]) | (1u<<typeIndices[0])}; for(const uint id : al::as_span(ids, static_cast<uint>(count))) { - if(!enable) - { - auto &idfilters = context->mDebugIdFilters[id]; - auto iter = std::lower_bound(idfilters.cbegin(), idfilters.cend(), filter); - if(iter == idfilters.cend() || *iter != filter) - idfilters.insert(iter, filter); - continue; - } - - auto iditer = context->mDebugIdFilters.find(id); - if(iditer == context->mDebugIdFilters.end()) - continue; - auto iter = std::lower_bound(iditer->second.cbegin(), iditer->second.cend(), filter); - if(iter != iditer->second.cend() && *iter == filter) - { - iditer->second.erase(iter); - if(iditer->second.empty()) - context->mDebugIdFilters.erase(iditer); - } + const uint64_t filter{filterbase | (uint64_t{id} << 32)}; + + auto iter = std::lower_bound(context->mDebugIdFilters.cbegin(), + context->mDebugIdFilters.cend(), filter); + if(!enable && (iter == context->mDebugIdFilters.cend() || *iter != filter)) + context->mDebugIdFilters.insert(iter, filter); + else if(enable && iter != context->mDebugIdFilters.cend() && *iter == filter) + context->mDebugIdFilters.erase(iter); } } else |