Add a couple new functions to handle deferred updates

Currently no-ops, they will be used in place of alcSuspendContext and
alcProcessContext for batching updates since the mentioned functions have no
coherent functionality between system implementations.
This commit is contained in:
Chris Robinson 2011-07-16 16:59:20 -07:00
parent 5f566ebf05
commit 163cc62a00
4 changed files with 67 additions and 13 deletions

View File

@ -275,6 +275,9 @@ static const ALCfunction alcFunctions[] = {
{ "alGetBufferSamplesSOFT", (ALCvoid *) alGetBufferSamplesSOFT },
{ "alIsBufferFormatSupportedSOFT",(ALCvoid *) alIsBufferFormatSupportedSOFT},
{ "alDeferUpdatesSOFT", (ALCvoid *) alDeferUpdatesSOFT },
{ "alProcessUpdatesSOFT", (ALCvoid *) alProcessUpdatesSOFT },
{ NULL, (ALCvoid *) NULL }
};
@ -1539,7 +1542,6 @@ static ALvoid InitContext(ALCcontext *pContext)
//Validate pContext
pContext->LastError = AL_NO_ERROR;
pContext->UpdateSources = AL_FALSE;
pContext->Suspended = AL_FALSE;
pContext->ActiveSourceCount = 0;
InitUIntMap(&pContext->SourceMap);
InitUIntMap(&pContext->EffectSlotMap);
@ -1550,6 +1552,7 @@ static ALvoid InitContext(ALCcontext *pContext)
pContext->DopplerFactor = 1.0f;
pContext->DopplerVelocity = 1.0f;
pContext->flSpeedOfSound = SPEEDOFSOUNDMETRESPERSEC;
pContext->DeferUpdates = AL_FALSE;
pContext->ExtensionList = alExtList;
}
@ -1759,12 +1762,9 @@ ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device)
Not functional
*/
ALC_API ALCvoid ALC_APIENTRY alcSuspendContext(ALCcontext *pContext)
ALC_API ALCvoid ALC_APIENTRY alcSuspendContext(ALCcontext *Context)
{
LockLists();
if(IsContext(pContext))
pContext->Suspended = AL_TRUE;
UnlockLists();
(void)Context;
}
@ -1773,12 +1773,9 @@ ALC_API ALCvoid ALC_APIENTRY alcSuspendContext(ALCcontext *pContext)
Not functional
*/
ALC_API ALCvoid ALC_APIENTRY alcProcessContext(ALCcontext *pContext)
ALC_API ALCvoid ALC_APIENTRY alcProcessContext(ALCcontext *Context)
{
LockLists();
if(IsContext(pContext))
pContext->Suspended = AL_FALSE;
UnlockLists();
(void)Context;
}

View File

@ -116,6 +116,17 @@ AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format);
#define AL_VIRTUAL_CHANNELS_SOFT 0x1033
#endif
#ifndef AL_SOFT_deferred_updates
#define AL_SOFT_deferred_updates 1
#define AL_DEFERRED_UPDATES_SOFT 0xC002
typedef ALvoid (AL_APIENTRY*LPALDEFERUPDATESSOFT)(void);
typedef ALvoid (AL_APIENTRY*LPALPROCESSUPDATESSOFT)(void);
#ifdef AL_ALEXT_PROTOTYPES
AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void);
AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void);
#endif
#endif
#if defined(HAVE_STDINT_H)
#include <stdint.h>
@ -465,7 +476,6 @@ struct ALCcontext_struct
ALenum LastError;
ALboolean UpdateSources;
ALboolean Suspended;
enum DistanceModel DistanceModel;
ALboolean SourceDistanceModel;
@ -473,6 +483,7 @@ struct ALCcontext_struct
ALfloat DopplerFactor;
ALfloat DopplerVelocity;
ALfloat flSpeedOfSound;
ALboolean DeferUpdates;
struct ALsource **ActiveSources;
ALsizei ActiveSourceCount;

View File

@ -213,6 +213,7 @@ static const ALenums enumeration[] = {
{ "AL_DISTANCE_MODEL", AL_DISTANCE_MODEL },
{ "AL_SPEED_OF_SOUND", AL_SPEED_OF_SOUND },
{ "AL_SOURCE_DISTANCE_MODEL", AL_SOURCE_DISTANCE_MODEL },
{ "AL_DEFERRED_UPDATES_SOFT", AL_DEFERRED_UPDATES_SOFT },
// Distance Models
{ "AL_INVERSE_DISTANCE", AL_INVERSE_DISTANCE },

View File

@ -138,6 +138,10 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname)
value = AL_TRUE;
break;
case AL_DEFERRED_UPDATES_SOFT:
value = Context->DeferUpdates;
break;
default:
alSetError(Context, AL_INVALID_ENUM);
break;
@ -174,6 +178,10 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname)
value = (double)Context->flSpeedOfSound;
break;
case AL_DEFERRED_UPDATES_SOFT:
value = (ALdouble)Context->DeferUpdates;
break;
default:
alSetError(Context, AL_INVALID_ENUM);
break;
@ -210,6 +218,10 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname)
value = Context->flSpeedOfSound;
break;
case AL_DEFERRED_UPDATES_SOFT:
value = (ALfloat)Context->DeferUpdates;
break;
default:
alSetError(Context, AL_INVALID_ENUM);
break;
@ -246,6 +258,10 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname)
value = (ALint)Context->flSpeedOfSound;
break;
case AL_DEFERRED_UPDATES_SOFT:
value = (ALint)Context->DeferUpdates;
break;
default:
alSetError(Context, AL_INVALID_ENUM);
break;
@ -268,6 +284,7 @@ AL_API ALvoid AL_APIENTRY alGetBooleanv(ALenum pname,ALboolean *data)
case AL_DOPPLER_VELOCITY:
case AL_DISTANCE_MODEL:
case AL_SPEED_OF_SOUND:
case AL_DEFERRED_UPDATES_SOFT:
*data = alGetBoolean(pname);
return;
}
@ -306,6 +323,7 @@ AL_API ALvoid AL_APIENTRY alGetDoublev(ALenum pname,ALdouble *data)
case AL_DOPPLER_VELOCITY:
case AL_DISTANCE_MODEL:
case AL_SPEED_OF_SOUND:
case AL_DEFERRED_UPDATES_SOFT:
*data = alGetDouble(pname);
return;
}
@ -344,6 +362,7 @@ AL_API ALvoid AL_APIENTRY alGetFloatv(ALenum pname,ALfloat *data)
case AL_DOPPLER_VELOCITY:
case AL_DISTANCE_MODEL:
case AL_SPEED_OF_SOUND:
case AL_DEFERRED_UPDATES_SOFT:
*data = alGetFloat(pname);
return;
}
@ -382,6 +401,7 @@ AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname,ALint *data)
case AL_DOPPLER_VELOCITY:
case AL_DISTANCE_MODEL:
case AL_SPEED_OF_SOUND:
case AL_DEFERRED_UPDATES_SOFT:
*data = alGetInteger(pname);
return;
}
@ -550,3 +570,28 @@ AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value)
UnlockContext(Context);
}
AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void)
{
ALCcontext *Context;
Context = GetLockedContext();
if(!Context) return;
Context->DeferUpdates = AL_TRUE;
UnlockContext(Context);
}
AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void)
{
ALCcontext *Context;
Context = GetLockedContext();
if(!Context) return;
Context->DeferUpdates = AL_FALSE;
UnlockContext(Context);
}