summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-09-20 14:54:28 -0700
committerChris Robinson <[email protected]>2012-09-20 14:54:28 -0700
commitccd35bffe7ba6365e194a9332cf73e71412b80cd (patch)
tree44c7d9b204c828fb062cf606463f2873b3622aef
parentd1c93525ed6f3e2ff42d6e7dcaf0c75521fa1556 (diff)
Help ensure the update size is a multiple of 4 with SSE
-rw-r--r--Alc/ALc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 7b18481c..dcbd848f 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1540,6 +1540,9 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
device->UpdateSize = (ALuint64)device->UpdateSize * freq /
device->Frequency;
+ /* SSE does best with the update size being a multiple of 4 */
+ if((CPUCapFlags&CPU_CAP_SSE))
+ device->UpdateSize = (device->UpdateSize+3)&~3;
device->Frequency = freq;
device->NumMonoSources = numMono;
@@ -2799,6 +2802,8 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
ConfigValueUInt(NULL, "period_size", &device->UpdateSize);
device->UpdateSize = clampu(device->UpdateSize, 64, 8192);
+ if((CPUCapFlags&CPU_CAP_SSE))
+ device->UpdateSize = (device->UpdateSize+3)&~3;
ConfigValueUInt(NULL, "sources", &device->MaxNoOfSources);
if(device->MaxNoOfSources == 0) device->MaxNoOfSources = 256;