diff options
Diffstat (limited to 'alc/context.cpp')
-rw-r--r-- | alc/context.cpp | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/alc/context.cpp b/alc/context.cpp index 755a1e41..0c8253fb 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -304,111 +304,6 @@ void ALCcontext::applyAllUpdates() } -void ALCcontext::sendDebugMessage(DebugSource source, DebugType type, ALuint id, - DebugSeverity severity, ALsizei length, const char *message) -{ - static_assert(DebugSeverityBase+DebugSeverityCount <= 32, "Too many debug bits"); - - /* MaxDebugMessageLength is the size including the null terminator, - * <length> does not include the null terminator. - */ - if(length < 0) - { - size_t newlen{std::strlen(message)}; - if(newlen >= MaxDebugMessageLength) UNLIKELY - { - ERR("Debug message too long (%zu >= %d)\n", newlen, MaxDebugMessageLength); - return; - } - length = static_cast<ALsizei>(newlen); - } - else if(length >= MaxDebugMessageLength) UNLIKELY - { - ERR("Debug message too long (%d >= %d)\n", length, MaxDebugMessageLength); - return; - } - - std::unique_lock<std::mutex> debuglock{mDebugCbLock}; - DebugGroup &debug = mDebugGroups.back(); - if(!mDebugEnabled.load()) UNLIKELY - return; - - auto get_source_enum = [source]() - { - switch(source) - { - case DebugSource::API: return AL_DEBUG_SOURCE_API_SOFT; - case DebugSource::System: return AL_DEBUG_SOURCE_AUDIO_SYSTEM_SOFT; - case DebugSource::ThirdParty: return AL_DEBUG_SOURCE_THIRD_PARTY_SOFT; - case DebugSource::Application: return AL_DEBUG_SOURCE_APPLICATION_SOFT; - case DebugSource::Other: return AL_DEBUG_SOURCE_OTHER_SOFT; - } - throw std::runtime_error{"Unexpected debug source value "+std::to_string(al::to_underlying(source))}; - }; - auto get_type_enum = [type]() - { - switch(type) - { - case DebugType::Error: return AL_DEBUG_TYPE_ERROR_SOFT; - case DebugType::DeprecatedBehavior: return AL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_SOFT; - case DebugType::UndefinedBehavior: return AL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_SOFT; - case DebugType::Portability: return AL_DEBUG_TYPE_PORTABILITY_SOFT; - case DebugType::Performance: return AL_DEBUG_TYPE_PERFORMANCE_SOFT; - case DebugType::Marker: return AL_DEBUG_TYPE_MARKER_SOFT; - case DebugType::Other: return AL_DEBUG_TYPE_OTHER_SOFT; - } - throw std::runtime_error{"Unexpected debug type value "+std::to_string(al::to_underlying(type))}; - }; - auto get_severity_enum = [severity]() - { - switch(severity) - { - case DebugSeverity::High: return AL_DEBUG_SEVERITY_HIGH_SOFT; - case DebugSeverity::Medium: return AL_DEBUG_SEVERITY_MEDIUM_SOFT; - case DebugSeverity::Low: return AL_DEBUG_SEVERITY_LOW_SOFT; - case DebugSeverity::Notification: return AL_DEBUG_SEVERITY_NOTIFICATION_SOFT; - } - throw std::runtime_error{"Unexpected debug severity value "+std::to_string(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(debug.mIdFilters.cbegin(), debug.mIdFilters.cend(), idfilter); - if(iditer != debug.mIdFilters.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(debug.mFilters.cbegin(), debug.mFilters.cend(), filter); - if(iter != debug.mFilters.cend() && *iter == filter) - return; - - if(mDebugCb) - { - auto callback = mDebugCb; - auto param = mDebugParam; - debuglock.unlock(); - callback(get_source_enum(), get_type_enum(), id, get_severity_enum(), length, message, - param); - } - else - { - if(mDebugLog.size() < MaxDebugLoggedMessages) - mDebugLog.emplace_back(source, type, id, severity, message); - else UNLIKELY - ERR("Debug message log overflow. Lost message:\n" - " Source: 0x%04x\n" - " Type: 0x%04x\n" - " ID: %u\n" - " Severity: 0x%04x\n" - " Message: \"%s\"\n", - get_source_enum(), get_type_enum(), id, get_severity_enum(), message); - } -} - - #ifdef ALSOFT_EAX namespace { |