| 273 | |
| 274 | FORCE_ALIGN DECL_FUNCEXT6(void, alDebugMessageControl,EXT, ALenum, ALenum, ALenum, ALsizei, const ALuint*, ALboolean) |
| 275 | FORCE_ALIGN void AL_APIENTRY alDebugMessageControlDirectEXT(ALCcontext *context, ALenum source, |
| 276 | ALenum type, ALenum severity, ALsizei count, const ALuint *ids, ALboolean enable) noexcept |
| 277 | { |
| 278 | if(count > 0) |
| 279 | { |
| 280 | if(!ids) |
| 281 | return context->setError(AL_INVALID_VALUE, "IDs is null with non-0 count"); |
| 282 | if(source == AL_DONT_CARE_EXT) |
| 283 | return context->setError(AL_INVALID_OPERATION, |
| 284 | "Debug source cannot be AL_DONT_CARE_EXT with IDs"); |
| 285 | if(type == AL_DONT_CARE_EXT) |
| 286 | return context->setError(AL_INVALID_OPERATION, |
| 287 | "Debug type cannot be AL_DONT_CARE_EXT with IDs"); |
| 288 | if(severity != AL_DONT_CARE_EXT) |
| 289 | return context->setError(AL_INVALID_OPERATION, |
| 290 | "Debug severity must be AL_DONT_CARE_EXT with IDs"); |
| 291 | } |
| 292 | |
| 293 | if(enable != AL_TRUE && enable != AL_FALSE) |
| 294 | return context->setError(AL_INVALID_ENUM, "Invalid debug enable %d", enable); |
| 295 | |
| 296 | static constexpr size_t ElemCount{DebugSourceCount + DebugTypeCount + DebugSeverityCount}; |
| 297 | static constexpr auto Values = make_array_sequence<uint8_t,ElemCount>(); |
| 298 | |
| 299 | auto srcIndices = al::span{Values}.subspan(DebugSourceBase,DebugSourceCount); |
| 300 | if(source != AL_DONT_CARE_EXT) |
| 301 | { |
| 302 | auto dsource = GetDebugSource(source); |
| 303 | if(!dsource) |
| 304 | return context->setError(AL_INVALID_ENUM, "Invalid debug source 0x%04x", source); |
| 305 | srcIndices = srcIndices.subspan(al::to_underlying(*dsource), 1); |
| 306 | } |
| 307 | |
| 308 | auto typeIndices = al::span{Values}.subspan(DebugTypeBase,DebugTypeCount); |
| 309 | if(type != AL_DONT_CARE_EXT) |
| 310 | { |
| 311 | auto dtype = GetDebugType(type); |
| 312 | if(!dtype) |
| 313 | return context->setError(AL_INVALID_ENUM, "Invalid debug type 0x%04x", type); |
| 314 | typeIndices = typeIndices.subspan(al::to_underlying(*dtype), 1); |
| 315 | } |
| 316 | |
| 317 | auto svrIndices = al::span{Values}.subspan(DebugSeverityBase,DebugSeverityCount); |
| 318 | if(severity != AL_DONT_CARE_EXT) |
| 319 | { |
| 320 | auto dseverity = GetDebugSeverity(severity); |
| 321 | if(!dseverity) |
| 322 | return context->setError(AL_INVALID_ENUM, "Invalid debug severity 0x%04x", severity); |
| 323 | svrIndices = svrIndices.subspan(al::to_underlying(*dseverity), 1); |
| 324 | } |
| 325 | |
| 326 | std::lock_guard<std::mutex> _{context->mDebugCbLock}; |
| 327 | DebugGroup &debug = context->mDebugGroups.back(); |
| 328 | if(count > 0) |
| 329 | { |
| 330 | const uint filterbase{(1u<<srcIndices[0]) | (1u<<typeIndices[0])}; |
| 331 | |
| 332 | for(const uint id : al::span{ids, static_cast<uint>(count)}) |
nothing calls this directly
no test coverage detected