aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-11-25 17:29:39 -0800
committerChris Robinson <[email protected]>2013-11-25 17:29:39 -0800
commit80ea801204cec06b26ac8823747ad0981165822c (patch)
tree4ba696fe3fb56d042d779a994051112380e2229e
parent191e8172f0ed00f423f7806b3b52b95d1dab53cc (diff)
Add a macro for GCC to ensure stack alignment
-rw-r--r--Alc/ALc.c2
-rw-r--r--Alc/backends/dsound.c2
-rw-r--r--Alc/backends/mmdevapi.c2
-rw-r--r--Alc/backends/qsa.c11
-rw-r--r--Alc/backends/winmm.c2
-rw-r--r--OpenAL32/Include/alMain.h10
6 files changed, 16 insertions, 13 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 2effb854..a4e2e95e 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -3383,7 +3383,7 @@ ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device
* Renders some samples into a buffer, using the format last set by the
* attributes given to alcCreateContext.
*/
-ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffer, ALCsizei samples)
+FORCE_ALIGN ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffer, ALCsizei samples)
{
if(!(device=VerifyDevice(device)) || device->Type != Loopback)
alcSetError(device, ALC_INVALID_DEVICE);
diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c
index 0c4f816b..6b108fba 100644
--- a/Alc/backends/dsound.c
+++ b/Alc/backends/dsound.c
@@ -224,7 +224,7 @@ static BOOL CALLBACK DSoundEnumCaptureDevices(LPGUID guid, LPCSTR desc, LPCSTR U
}
-static ALuint DSoundPlaybackProc(ALvoid *ptr)
+FORCE_ALIGN static ALuint DSoundPlaybackProc(ALvoid *ptr)
{
ALCdevice *Device = (ALCdevice*)ptr;
DSoundPlaybackData *data = (DSoundPlaybackData*)Device->ExtraData;
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index 8bbbbddb..fa7c54f9 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -220,7 +220,7 @@ static DevMap *ProbeDevices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, ALu
}
-static ALuint MMDevApiProc(ALvoid *ptr)
+FORCE_ALIGN static ALuint MMDevApiProc(ALvoid *ptr)
{
ALCdevice *device = ptr;
MMDevApiData *data = device->ExtraData;
diff --git a/Alc/backends/qsa.c b/Alc/backends/qsa.c
index ae3ace61..c9762f85 100644
--- a/Alc/backends/qsa.c
+++ b/Alc/backends/qsa.c
@@ -177,15 +177,8 @@ static DevMap* deviceList(int type, ALuint* count)
return dev_list;
}
-/* force_align_arg_pointer is required for proper function arguments */
-/* aligning, when SSE mixer is used. QNX has a bug in pthread_create */
-/* function regarding thread stack alignment, it uses 64 bit align */
-/* instead of 128 bit, like main thread. */
-#if defined(__GNUC__) && (_NTO_VERSION <= 650) && \
- defined(__i386__) && defined(HAVE_SSE)
-__attribute__((force_align_arg_pointer))
-#endif /* __GNUC__ && QNX version < 6.5.0 on x86 platform with SSE support */
-static ALuint qsa_proc_playback(ALvoid* ptr)
+
+FORCE_ALIGN static ALuint qsa_proc_playback(ALvoid* ptr)
{
ALCdevice* device=(ALCdevice*)ptr;
qsa_data* data=(qsa_data*)device->ExtraData;
diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c
index f268aca7..7082a874 100644
--- a/Alc/backends/winmm.c
+++ b/Alc/backends/winmm.c
@@ -165,7 +165,7 @@ static void CALLBACK WaveOutProc(HWAVEOUT UNUSED(device), UINT msg, DWORD_PTR in
Used by "MMSYSTEM" Device. Called when a WaveOut buffer has used up its
audio data.
*/
-static DWORD WINAPI PlaybackThreadProc(LPVOID param)
+FORCE_ALIGN static DWORD WINAPI PlaybackThreadProc(LPVOID param)
{
ALCdevice *Device = (ALCdevice*)param;
WinMMData *data = Device->ExtraData;
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index cc631935..e0753ea8 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -74,6 +74,16 @@ typedef ptrdiff_t ALsizeiptrEXT;
#define PRINTF_STYLE(x, y)
#endif
+#if defined(__GNUC__) && defined(__i386__)
+/* force_align_arg_pointer is required for proper function arguments aligning
+ * when SSE code is used. Some systems (Windows, QNX) do not guarantee our
+ * thread functions will be properly aligned on the stack, even though GCC may
+ * generate code with the assumption that it is. */
+#define FORCE_ALIGN __attribute__((force_align_arg_pointer))
+#else
+#define FORCE_ALIGN
+#endif
+
static const union {
ALuint u;