diff options
-rw-r--r-- | al/debug.cpp | 29 | ||||
-rw-r--r-- | alc/context.cpp | 23 | ||||
-rw-r--r-- | alc/context.h | 2 |
3 files changed, 19 insertions, 35 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 diff --git a/alc/context.cpp b/alc/context.cpp index bb4930ee..7d10a91d 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -369,21 +369,16 @@ void ALCcontext::sendDebugMessage(DebugSource source, DebugType type, ALuint id, throw std::runtime_error{"Unexpected debug severity value "+std::to_string(al::to_underlying(severity))}; }; - auto iditer = mDebugIdFilters.find(id); - if(iditer != mDebugIdFilters.end()) - { - const uint filter{(1u<<(DebugSourceBase+al::to_underlying(source))) - | (1u<<(DebugTypeBase+al::to_underlying(type)))}; - - auto iter = std::lower_bound(iditer->second.cbegin(), iditer->second.cend(), filter); - if(iter != iditer->second.cend() && *iter == filter) - return; - } - - const uint filter{(1u<<(DebugSourceBase+al::to_underlying(source))) - | (1u<<(DebugTypeBase+al::to_underlying(type))) - | (1u<<(DebugSeverityBase+al::to_underlying(severity)))}; + const uint64_t idfilter{(1_u64 << (DebugSourceBase+al::to_underlying(source))) + | (1_u64 << (DebugTypeBase+al::to_underlying(type))) + | (uint64_t{id} << 32)}; + auto iditer = std::lower_bound(mDebugIdFilters.cbegin(), mDebugIdFilters.cend(), idfilter); + if(iditer != mDebugIdFilters.cend() && *iditer == idfilter) + return; + const uint filter{(1u << (DebugSourceBase+al::to_underlying(source))) + | (1u << (DebugTypeBase+al::to_underlying(type))) + | (1u << (DebugSeverityBase+al::to_underlying(severity)))}; auto iter = std::lower_bound(mDebugFilters.cbegin(), mDebugFilters.cend(), filter); if(iter != mDebugFilters.cend() && *iter == filter) return; diff --git a/alc/context.h b/alc/context.h index c626160b..b3f548c8 100644 --- a/alc/context.h +++ b/alc/context.h @@ -146,7 +146,7 @@ struct ALCcontext : public al::intrusive_ref<ALCcontext>, ContextBase { ALDEBUGPROCSOFT mDebugCb{}; void *mDebugParam{nullptr}; std::vector<uint> mDebugFilters; - std::unordered_map<uint,std::vector<uint>> mDebugIdFilters; + std::vector<uint64_t> mDebugIdFilters; std::deque<LogEntry> mDebugLog; ALlistener mListener{}; |