Skip to content

Commit

Permalink
Minor reworkings for Intel Macs...just enough to get it to compile...
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Dec 17, 2005
1 parent 5355bf3 commit 1e681aa
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 15 deletions.
8 changes: 7 additions & 1 deletion osx/alContext.c
Expand Up @@ -380,7 +380,7 @@ ALCAPI ALboolean ALCAPIENTRY alcIsExtensionPresent(ALCdevice *device, ALubyte *e
return(__alIsExtensionPresent(extName, AL_TRUE));

// !!! FIXME: hack.
if (strcasecmp(extName, "ALC_EXT_disconnect") == 0)
if (strcasecmp((const char *) extName, "ALC_EXT_disconnect") == 0)
return(__alIsExtensionPresent(extName, AL_TRUE));

// !!! FIXME: Fill in device-specific extensions here.
Expand Down Expand Up @@ -748,6 +748,7 @@ ALboolean __alDetectVectorUnit(ALvoid)
static ALboolean __alcVectorUnitDetected = AL_FALSE;
if (__alcAlreadyDidVectorUnitDetection == AL_FALSE)
{
#if __POWERPC__
OSErr err;
long cpufeature = 0;
err = Gestalt(gestaltPowerPCProcessorFeatures, &cpufeature);
Expand All @@ -756,6 +757,11 @@ ALboolean __alDetectVectorUnit(ALvoid)
if ((1 << gestaltPowerPCHasVectorInstructions) & cpufeature)
__alcVectorUnitDetected = AL_TRUE;
} // if
#else
// !!! FIXME: sse detection?
#endif

__alcAlreadyDidVectorUnitDetection = AL_TRUE;
} // if

return(__alcVectorUnitDetected);
Expand Down
2 changes: 1 addition & 1 deletion osx/alMath.h
Expand Up @@ -76,7 +76,7 @@ static inline ALvoid __alSinCos(ALfloat f, ALfloat *s, ALfloat *c)

// Square root stuff.
#if (!defined FORCE_STD_SQRT)
# if (!MACOSX)
# if ((!MACOSX) || (!__POWERPC__))
# define FORCE_STD_SQRT 1
# endif
#endif
Expand Down
31 changes: 25 additions & 6 deletions osx/alSoftware.c
Expand Up @@ -668,8 +668,10 @@ UInt32 __alMixStereo16(ALcontext *ctx, ALbuffer *buf, ALsource *src, Float32 *_d
// !!! FIXME: Altivec mixers only work in stereo configurations.
UInt32 __alMixMono8_altivec(ALcontext *ctx, ALbuffer *buf, ALsource *src, Float32 *_dst, UInt32 frames)
{
register UInt32 buflen = buf->allocatedSpace - src->bufferReadIndex;
register ALsizei overflow = 0;

#if __POWERPC__
register UInt32 buflen = buf->allocatedSpace - src->bufferReadIndex;
register SInt8 *in = ((SInt8 *) buf->mixData) + src->bufferReadIndex;
register Float32 *dst = _dst;
register Float32 *max;
Expand Down Expand Up @@ -857,16 +859,20 @@ UInt32 __alMixMono8_altivec(ALcontext *ctx, ALbuffer *buf, ALsource *src, Float3
} // if

src->bufferReadIndex += frames;
#endif // __POWERPC__

return(overflow);
} // __alMixMono8_altivec


UInt32 __alMixMono16_altivec(ALcontext *ctx, ALbuffer *buf, ALsource *src, Float32 *_dst, UInt32 frames)
{
register ALsizei overflow = 0;

#if __POWERPC__
//register UInt32 ctrl_in = DST_BLOCK_CTRL(1, 2, 16);
//register UInt32 ctrl_out = DST_BLOCK_CTRL(1, 8, 16);
register UInt32 buflen = (buf->allocatedSpace >> 1) - src->bufferReadIndex;
register ALsizei overflow = 0;
register SInt16 *in = ((SInt16 *) buf->mixData) + src->bufferReadIndex;
register Float32 *dst = _dst;
register Float32 *max;
Expand Down Expand Up @@ -1032,14 +1038,18 @@ UInt32 __alMixMono16_altivec(ALcontext *ctx, ALbuffer *buf, ALsource *src, Float
} // if

src->bufferReadIndex += frames;
#endif // __POWERPC__

return(overflow);
} // __alMixMono16_altivec


UInt32 __alMixStereo16_altivec(ALcontext *ctx, ALbuffer *buf, ALsource *src, Float32 *_dst, UInt32 frames)
{
register UInt32 buflen = (buf->allocatedSpace >> 2) - src->bufferReadIndex;
register ALsizei overflow = 0;

#if __POWERPC__
register UInt32 buflen = (buf->allocatedSpace >> 2) - src->bufferReadIndex;
register SInt16 *in = ((SInt16 *) buf->mixData) + (src->bufferReadIndex << 1);
register Float32 *dst = _dst;
register Float32 *max;
Expand Down Expand Up @@ -1136,6 +1146,8 @@ UInt32 __alMixStereo16_altivec(ALcontext *ctx, ALbuffer *buf, ALsource *src, Flo
} // if

src->bufferReadIndex += frames;
#endif // __POWERPC__

return(overflow);
} // __alMixStereo16_altivec

Expand Down Expand Up @@ -1243,8 +1255,10 @@ UInt32 __alMixStereoFloat32(ALcontext *ctx, ALbuffer *buf, ALsource *src, Float3

UInt32 __alMixMonoFloat32_altivec(ALcontext *ctx, ALbuffer *buf, ALsource *src, Float32 *_dst, UInt32 frames)
{
register UInt32 buflen = (buf->allocatedSpace >> 2) - src->bufferReadIndex;
register ALsizei overflow = 0;

#if __POWERPC__
register UInt32 buflen = (buf->allocatedSpace >> 2) - src->bufferReadIndex;
register Float32 *in = ((Float32 *) buf->mixData) + src->bufferReadIndex;
register Float32 *dst = _dst;
register Float32 *max;
Expand Down Expand Up @@ -1364,14 +1378,18 @@ UInt32 __alMixMonoFloat32_altivec(ALcontext *ctx, ALbuffer *buf, ALsource *src,
} // if

src->bufferReadIndex += frames;
#endif // __POWERPC__

return(overflow);
} // __alMixMonoFloat32_altivec


UInt32 __alMixStereoFloat32_altivec(ALcontext *ctx, ALbuffer *buf, ALsource *src, Float32 *_dst, UInt32 frames)
{
register UInt32 buflen = (buf->allocatedSpace >> 3) - src->bufferReadIndex;
register ALsizei overflow = 0;

#if __POWERPC__
register UInt32 buflen = (buf->allocatedSpace >> 3) - src->bufferReadIndex;
register Float32 *in = ((Float32 *) buf->mixData) + (src->bufferReadIndex << 1);
register Float32 *dst = _dst;
register Float32 *max;
Expand Down Expand Up @@ -1447,9 +1465,10 @@ UInt32 __alMixStereoFloat32_altivec(ALcontext *ctx, ALbuffer *buf, ALsource *src
} // if

src->bufferReadIndex += frames;
#endif // __POWERPC__

return(overflow);
} // __alMixStereoFloat32_altivec

#endif

// end of alSoftware.c ...
Expand Down
14 changes: 7 additions & 7 deletions osx/makefile
Expand Up @@ -31,18 +31,18 @@
# If you don't already know what the various SUPPORT_* things do,
# leave them alone.

OPTIMIZE := false
OPTIMIZE := true
USE_G4_OPCODES := false
USE_G5_OPCODES := false
USE_CCACHE := true
USE_CCACHE := false
USE_IBM_COMPILER := false
SUPPORT_ALC_ENUMERATION_EXT := true
SUPPORT_ALC_EXT_CAPTURE := true
SUPPORT_ALC_EXT_DISCONNECT := true
SUPPORT_ALC_EXT_CAPTURE := false
SUPPORT_ALC_EXT_DISCONNECT := false
SUPPORT_AL_EXT_VORBIS := false
SUPPORT_AL_EXT_MP3 := false
SUPPORT_AL_EXT_VECTOR_UNIT := true
SUPPORT_AL_EXT_BUFFER_OFFSET := true
SUPPORT_AL_EXT_VECTOR_UNIT := false
SUPPORT_AL_EXT_BUFFER_OFFSET := false
SUPPORT_AL_EXT_FLOAT32 := true

# ----------------------------------------------------------------------------
Expand Down Expand Up @@ -84,7 +84,7 @@ ifeq ($(strip $(USE_IBM_COMPILER)),true)
endif
else
COMPILER := gcc
COMPILERFLAGS := -Wall -faltivec -fasm -force_cpusubtype_ALL -fsigned-chars -fPIC
COMPILERFLAGS := -Wall -faltivec -fasm -force_cpusubtype_ALL -fPIC
ifeq ($(strip $(OPTIMIZE)),true)
ifeq ($(strip $(USE_G5_OPCODES)),true)
OPTIMIZATIONS += -mcpu=G5 -mtune=G5 -mpowerpc-gpopt -mpowerpc64 -DFORCE_STD_SQRT=1
Expand Down

0 comments on commit 1e681aa

Please sign in to comment.