aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
Diffstat (limited to 'alc')
-rw-r--r--alc/alc.cpp1
-rw-r--r--alc/context.cpp10
-rw-r--r--alc/context.h60
3 files changed, 15 insertions, 56 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index 63654b1a..aa65222c 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -61,6 +61,7 @@
#include "al/auxeffectslot.h"
#include "al/buffer.h"
+#include "al/debug.h"
#include "al/effect.h"
#include "al/filter.h"
#include "al/listener.h"
diff --git a/alc/context.cpp b/alc/context.cpp
index 7d10a91d..755a1e41 100644
--- a/alc/context.cpp
+++ b/alc/context.cpp
@@ -122,6 +122,7 @@ void ALCcontext::setThreadContext(ALCcontext *context) noexcept
ALCcontext::ALCcontext(al::intrusive_ptr<ALCdevice> device)
: ContextBase{device.get()}, mALDevice{std::move(device)}
{
+ mDebugGroups.emplace_back(DebugSource::Other, 0, std::string{});
}
ALCcontext::~ALCcontext()
@@ -328,6 +329,7 @@ void ALCcontext::sendDebugMessage(DebugSource source, DebugType type, ALuint id,
}
std::unique_lock<std::mutex> debuglock{mDebugCbLock};
+ DebugGroup &debug = mDebugGroups.back();
if(!mDebugEnabled.load()) UNLIKELY
return;
@@ -372,15 +374,15 @@ void ALCcontext::sendDebugMessage(DebugSource source, DebugType type, ALuint id,
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)
+ 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(mDebugFilters.cbegin(), mDebugFilters.cend(), filter);
- if(iter != mDebugFilters.cend() && *iter == filter)
+ auto iter = std::lower_bound(debug.mFilters.cbegin(), debug.mFilters.cend(), filter);
+ if(iter != debug.mFilters.cend() && *iter == filter)
return;
if(mDebugCb)
diff --git a/alc/context.h b/alc/context.h
index b3f548c8..3e31c9b8 100644
--- a/alc/context.h
+++ b/alc/context.h
@@ -33,57 +33,14 @@
struct ALeffect;
struct ALeffectslot;
struct ALsource;
+struct DebugGroup;
+struct DebugLogEntry;
-using uint = unsigned int;
-
+enum class DebugSource : uint8_t;
+enum class DebugType : uint8_t;
+enum class DebugSeverity : uint8_t;
-constexpr uint DebugSourceBase{0};
-enum class DebugSource : uint8_t {
- API = 0,
- System,
- ThirdParty,
- Application,
- Other,
-};
-constexpr uint DebugSourceCount{5};
-
-constexpr uint DebugTypeBase{DebugSourceBase + DebugSourceCount};
-enum class DebugType : uint8_t {
- Error = 0,
- DeprecatedBehavior,
- UndefinedBehavior,
- Portability,
- Performance,
- Marker,
- Other,
-};
-constexpr uint DebugTypeCount{7};
-
-constexpr uint DebugSeverityBase{DebugTypeBase + DebugTypeCount};
-enum class DebugSeverity : uint8_t {
- High = 0,
- Medium,
- Low,
- Notification,
-};
-constexpr uint DebugSeverityCount{4};
-
-struct LogEntry {
- const DebugSource mSource;
- const DebugType mType;
- const DebugSeverity mSeverity;
- const uint mId;
-
- std::string mMessage;
-
- template<typename T>
- LogEntry(DebugSource source, DebugType type, uint id, DebugSeverity severity, T&& message)
- : mSource{source}, mType{type}, mSeverity{severity}, mId{id}
- , mMessage{std::forward<T>(message)}
- { }
- LogEntry(const LogEntry&) = default;
- LogEntry(LogEntry&&) = default;
-};
+using uint = unsigned int;
struct SourceSubList {
@@ -145,9 +102,8 @@ struct ALCcontext : public al::intrusive_ref<ALCcontext>, ContextBase {
std::mutex mDebugCbLock;
ALDEBUGPROCSOFT mDebugCb{};
void *mDebugParam{nullptr};
- std::vector<uint> mDebugFilters;
- std::vector<uint64_t> mDebugIdFilters;
- std::deque<LogEntry> mDebugLog;
+ std::vector<DebugGroup> mDebugGroups;
+ std::deque<DebugLogEntry> mDebugLog;
ALlistener mListener{};