From e57da7c825607f2756227f4d4273146e8f79bce0 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 29 Apr 2023 22:15:07 -0700 Subject: Provide some more debug messages --- al/state.cpp | 31 ++++++++++++++++++++++++------- alc/alc.cpp | 30 ++++++++++++++++++++++-------- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/al/state.cpp b/al/state.cpp index 516797aa..777492ef 100644 --- a/al/state.cpp +++ b/al/state.cpp @@ -261,6 +261,10 @@ START_API_FUNC break; case AL_DOPPLER_VELOCITY: + context->debugMessage(DebugSource::API, DebugType::DeprecatedBehavior, 0, + DebugSeverity::Medium, -1, + "AL_DOPPLER_VELOCITY is deprecated in AL 1.1, use AL_SPEED_OF_SOUND; " + "AL_DOPPLER_VELOCITY -> AL_SPEED_OF_SOUND / 343.3f"); if(context->mDopplerVelocity != 0.0f) value = AL_TRUE; break; @@ -317,6 +321,10 @@ START_API_FUNC break; case AL_DOPPLER_VELOCITY: + context->debugMessage(DebugSource::API, DebugType::DeprecatedBehavior, 0, + DebugSeverity::Medium, -1, + "AL_DOPPLER_VELOCITY is deprecated in AL 1.1, use AL_SPEED_OF_SOUND; " + "AL_DOPPLER_VELOCITY -> AL_SPEED_OF_SOUND / 343.3f"); value = context->mDopplerVelocity; break; @@ -368,6 +376,10 @@ START_API_FUNC break; case AL_DOPPLER_VELOCITY: + context->debugMessage(DebugSource::API, DebugType::DeprecatedBehavior, 0, + DebugSeverity::Medium, -1, + "AL_DOPPLER_VELOCITY is deprecated in AL 1.1, use AL_SPEED_OF_SOUND; " + "AL_DOPPLER_VELOCITY -> AL_SPEED_OF_SOUND / 343.3f"); value = context->mDopplerVelocity; break; @@ -419,6 +431,10 @@ START_API_FUNC break; case AL_DOPPLER_VELOCITY: + context->debugMessage(DebugSource::API, DebugType::DeprecatedBehavior, 0, + DebugSeverity::Medium, -1, + "AL_DOPPLER_VELOCITY is deprecated in AL 1.1, use AL_SPEED_OF_SOUND; " + "AL_DOPPLER_VELOCITY -> AL_SPEED_OF_SOUND / 343.3f"); value = static_cast(context->mDopplerVelocity); break; @@ -505,6 +521,10 @@ START_API_FUNC break; case AL_DOPPLER_VELOCITY: + context->debugMessage(DebugSource::API, DebugType::DeprecatedBehavior, 0, + DebugSeverity::Medium, -1, + "AL_DOPPLER_VELOCITY is deprecated in AL 1.1, use AL_SPEED_OF_SOUND; " + "AL_DOPPLER_VELOCITY -> AL_SPEED_OF_SOUND / 343.3f"); value = static_cast(context->mDopplerVelocity); break; @@ -848,13 +868,10 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(!context) UNLIKELY return; - if(context->mDebugEnabled.load(std::memory_order_relaxed)) - { - static constexpr char deprecatedMessage[] = "alDopplerVelocity is deprecated in AL 1.1"; - context->sendDebugMessage(DebugSource::API, DebugType::DeprecatedBehavior, 0, - DebugSeverity::Medium, static_cast(std::strlen(deprecatedMessage)), - deprecatedMessage); - } + context->debugMessage(DebugSource::API, DebugType::DeprecatedBehavior, 0, + DebugSeverity::Medium, -1, + "alDopplerVelocity is deprecated in AL 1.1, use alSpeedOfSound; " + "alDopplerVelocity(x) -> alSpeedOfSound(343.3f * x)"); if(!(value >= 0.0f && std::isfinite(value))) context->setError(AL_INVALID_VALUE, "Doppler velocity %f out of range", value); diff --git a/alc/alc.cpp b/alc/alc.cpp index 0ed0ae58..33531afb 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -2584,13 +2584,20 @@ END_API_FUNC ALC_API void ALC_APIENTRY alcSuspendContext(ALCcontext *context) START_API_FUNC { - if(!SuspendDefers) - return; - ContextRef ctx{VerifyContext(context)}; if(!ctx) + { alcSetError(nullptr, ALC_INVALID_CONTEXT); - else + 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(SuspendDefers) { std::lock_guard _{ctx->mPropLock}; ctx->deferUpdates(); @@ -2601,13 +2608,20 @@ END_API_FUNC ALC_API void ALC_APIENTRY alcProcessContext(ALCcontext *context) START_API_FUNC { - if(!SuspendDefers) - return; - ContextRef ctx{VerifyContext(context)}; if(!ctx) + { alcSetError(nullptr, ALC_INVALID_CONTEXT); - else + 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(SuspendDefers) { std::lock_guard _{ctx->mPropLock}; ctx->processUpdates(); -- cgit v1.2.3