Update OpenAL Soft to commit 414b56edec5441211dc924fef365c54267c04f1c

This commit is contained in:
Alex Szpakowski
2018-04-03 20:46:26 -03:00
parent ac70ec9f6f
commit 5be7c968b8
138 changed files with 18084 additions and 18482 deletions
+43 -12
View File
@@ -21,6 +21,7 @@
#include "config.h"
#include <signal.h>
#include <stdarg.h>
#ifdef HAVE_WINDOWS_H
#define WIN32_LEAN_AND_MEAN
@@ -33,11 +34,32 @@
ALboolean TrapALError = AL_FALSE;
ALvoid alSetError(ALCcontext *Context, ALenum errorCode)
void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...)
{
ALenum curerr = AL_NO_ERROR;
char message[1024] = { 0 };
va_list args;
int msglen;
WARN("Error generated on context %p, code 0x%04x\n", Context, errorCode);
va_start(args, msg);
msglen = vsnprintf(message, sizeof(message), msg, args);
va_end(args);
if(msglen < 0 || (size_t)msglen >= sizeof(message))
{
message[sizeof(message)-1] = 0;
msglen = (int)strlen(message);
}
if(msglen > 0)
msg = message;
else
{
msg = "<internal error constructing message>";
msglen = (int)strlen(msg);
}
WARN("Error generated on context %p, code 0x%04x, \"%s\"\n",
context, errorCode, message);
if(TrapALError)
{
#ifdef _WIN32
@@ -49,19 +71,29 @@ ALvoid alSetError(ALCcontext *Context, ALenum errorCode)
#endif
}
(void)(ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(&Context->LastError, &curerr, errorCode));
ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(&context->LastError, &curerr, errorCode);
if((ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed)&EventType_Error))
{
ALbitfieldSOFT enabledevts;
almtx_lock(&context->EventCbLock);
enabledevts = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed);
if((enabledevts&EventType_Error) && context->EventCb)
(*context->EventCb)(AL_EVENT_TYPE_ERROR_SOFT, 0, errorCode, msglen, msg,
context->EventParam);
almtx_unlock(&context->EventCbLock);
}
}
AL_API ALenum AL_APIENTRY alGetError(void)
{
ALCcontext *Context;
ALCcontext *context;
ALenum errorCode;
Context = GetContextRef();
if(!Context)
context = GetContextRef();
if(!context)
{
WARN("Querying error state on null context (implicitly 0x%04x)\n",
AL_INVALID_OPERATION);
const ALenum deferror = AL_INVALID_OPERATION;
WARN("Querying error state on null context (implicitly 0x%04x)\n", deferror);
if(TrapALError)
{
#ifdef _WIN32
@@ -71,12 +103,11 @@ AL_API ALenum AL_APIENTRY alGetError(void)
raise(SIGTRAP);
#endif
}
return AL_INVALID_OPERATION;
return deferror;
}
errorCode = ATOMIC_EXCHANGE_SEQ(&Context->LastError, AL_NO_ERROR);
ALCcontext_DecRef(Context);
errorCode = ATOMIC_EXCHANGE_SEQ(&context->LastError, AL_NO_ERROR);
ALCcontext_DecRef(context);
return errorCode;
}