diff options
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 41 | ||||
-rw-r--r-- | alc/context.cpp | 7 | ||||
-rw-r--r-- | alc/context.h | 9 | ||||
-rw-r--r-- | alc/inprogext.h | 11 |
4 files changed, 51 insertions, 17 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index de5bc232..8932a084 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -573,6 +573,9 @@ constexpr struct { DECL(ALC_INVALID_VALUE), DECL(ALC_OUT_OF_MEMORY), + DECL(ALC_CONTEXT_FLAGS_EXT), + DECL(ALC_CONTEXT_DEBUG_BIT_EXT), + DECL(AL_INVALID), DECL(AL_NONE), @@ -1021,6 +1024,7 @@ constexpr ALCchar alcExtensionList[] = "ALC_ENUMERATE_ALL_EXT " "ALC_ENUMERATION_EXT " "ALC_EXT_CAPTURE " + "ALC_EXTX_debug " "ALC_EXT_DEDICATED " "ALC_EXT_disconnect " "ALC_EXT_EFX " @@ -2619,11 +2623,12 @@ START_API_FUNC return; } - ctx->debugMessage(DebugSource::API, DebugType::Portability, 0, DebugSeverity::Medium, -1, - "alcSuspendContext behavior is not portable -- some implementations suspend all " - "rendering, some only defer property changes, and some are completely no-op; consider " - "using alcDevicePauseSOFT to suspend all rendering, or alDeferUpdatesSOFT to only defer " - "property changes"); + if(context->mContextFlags.test(ContextFlags::DebugBit)) UNLIKELY + ctx->debugMessage(DebugSource::API, DebugType::Portability, 0, DebugSeverity::Medium, -1, + "alcSuspendContext behavior is not portable -- some implementations suspend all " + "rendering, some only defer property changes, and some are completely no-op; consider " + "using alcDevicePauseSOFT to suspend all rendering, or alDeferUpdatesSOFT to only " + "defer property changes"); if(SuspendDefers) { @@ -2643,11 +2648,12 @@ START_API_FUNC return; } - ctx->debugMessage(DebugSource::API, DebugType::Portability, 0, DebugSeverity::Medium, -1, - "alcProcessContext behavior is not portable -- some implementations resume rendering, " - "some apply deferred property changes, and some are completely no-op; consider using " - "alcDeviceResumeSOFT to resume rendering, or alProcessUpdatesSOFT to apply deferred " - "property changes"); + if(context->mContextFlags.test(ContextFlags::DebugBit)) UNLIKELY + ctx->debugMessage(DebugSource::API, DebugType::Portability, 0, DebugSeverity::Medium, -1, + "alcProcessContext behavior is not portable -- some implementations resume rendering, " + "some apply deferred property changes, and some are completely no-op; consider using " + "alcDeviceResumeSOFT to resume rendering, or alProcessUpdatesSOFT to apply deferred " + "property changes"); if(SuspendDefers) { @@ -3366,7 +3372,20 @@ START_API_FUNC return nullptr; } - ContextRef context{new ALCcontext{dev}}; + ContextFlagBitset ctxflags{0}; + if(attrList) + { + for(size_t i{0};attrList[i];i+=2) + { + if(attrList[i] == ALC_CONTEXT_FLAGS_EXT) + { + ctxflags = static_cast<ALuint>(attrList[i+1]); + break; + } + } + } + + ContextRef context{new ALCcontext{dev, ctxflags}}; context->init(); if(auto volopt = dev->configValue<float>(nullptr, "volume-adjust")) diff --git a/alc/context.cpp b/alc/context.cpp index 6a2f57ca..2fbf67af 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -51,7 +51,7 @@ using voidp = void*; constexpr ALchar alExtList[] = "AL_EXT_ALAW " "AL_EXT_BFORMAT " - "AL_EXTX_DEBUG " + "AL_EXTX_debug " "AL_EXT_DOUBLE " "AL_EXT_EXPONENT_DISTANCE " "AL_EXT_FLOAT32 " @@ -119,10 +119,11 @@ void ALCcontext::setThreadContext(ALCcontext *context) noexcept { sThreadContext.set(context); } #endif -ALCcontext::ALCcontext(al::intrusive_ptr<ALCdevice> device) - : ContextBase{device.get()}, mALDevice{std::move(device)} +ALCcontext::ALCcontext(al::intrusive_ptr<ALCdevice> device, ContextFlagBitset flags) + : ContextBase{device.get()}, mALDevice{std::move(device)}, mContextFlags{flags} { mDebugGroups.emplace_back(DebugSource::Other, 0, std::string{}); + mDebugEnabled.store(mContextFlags.test(ContextFlags::DebugBit), std::memory_order_relaxed); } ALCcontext::~ALCcontext() diff --git a/alc/context.h b/alc/context.h index 9381db04..402794eb 100644 --- a/alc/context.h +++ b/alc/context.h @@ -43,6 +43,12 @@ enum class DebugSeverity : uint8_t; using uint = unsigned int; +enum ContextFlags { + DebugBit = 0, /* ALC_CONTEXT_DEBUG_BIT_EXT */ +}; +using ContextFlagBitset = std::bitset<sizeof(ALuint)*8>; + + struct DebugLogEntry { const DebugSource mSource; const DebugType mType; @@ -103,6 +109,7 @@ struct ALCcontext : public al::intrusive_ref<ALCcontext>, ContextBase { std::atomic<ALenum> mLastError{AL_NO_ERROR}; + const ContextFlagBitset mContextFlags; std::atomic<bool> mDebugEnabled{false}; DistanceModel mDistanceModel{DistanceModel::Default}; @@ -141,7 +148,7 @@ struct ALCcontext : public al::intrusive_ref<ALCcontext>, ContextBase { std::string mExtensionListOverride{}; - ALCcontext(al::intrusive_ptr<ALCdevice> device); + ALCcontext(al::intrusive_ptr<ALCdevice> device, ContextFlagBitset flags); ALCcontext(const ALCcontext&) = delete; ALCcontext& operator=(const ALCcontext&) = delete; ~ALCcontext(); diff --git a/alc/inprogext.h b/alc/inprogext.h index 9db3b65b..b39eaa58 100644 --- a/alc/inprogext.h +++ b/alc/inprogext.h @@ -54,8 +54,14 @@ AL_API void AL_APIENTRY alAuxiliaryEffectSlotStopvSOFT(ALsizei n, const ALuint * #define AL_STOP_SOURCES_ON_DISCONNECT_SOFT 0x19AB #endif -#ifndef AL_EXT_DEBUG -#define AL_EXT_DEBUG +#ifndef ALC_EXT_debug +#define ALC_EXT_debug +#define ALC_CONTEXT_FLAGS_EXT 0x19CE +#define ALC_CONTEXT_DEBUG_BIT_EXT 0x0001 +#endif + +#ifndef AL_EXT_debug +#define AL_EXT_debug #define AL_DONT_CARE_EXT 0x0002 #define AL_DEBUG_OUTPUT_EXT 0x19B2 #define AL_DEBUG_CALLBACK_FUNCTION_EXT 0x19B3 @@ -85,6 +91,7 @@ AL_API void AL_APIENTRY alAuxiliaryEffectSlotStopvSOFT(ALsizei n, const ALuint * #define AL_MAX_DEBUG_GROUP_STACK_DEPTH_EXT 0x19CB #define AL_STACK_OVERFLOW_EXT 0x19CC #define AL_STACK_UNDERFLOW_EXT 0x19CD +#define AL_CONTEXT_FLAGS_EXT 0x19CE typedef void (AL_APIENTRY*ALDEBUGPROCEXT)(ALenum source, ALenum type, ALuint id, ALenum severity, ALsizei length, const ALchar *message, void *userParam); typedef void (AL_APIENTRY*LPALDEBUGMESSAGECALLBACKEXT)(ALDEBUGPROCEXT callback, void *userParam); |