diff options
-rw-r--r-- | Alc/ALc.c | 4 | ||||
-rw-r--r-- | Alc/helpers.c | 17 | ||||
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 3 | ||||
-rw-r--r-- | alsoftrc.sample | 2 |
5 files changed, 22 insertions, 8 deletions
@@ -845,7 +845,7 @@ static void alc_initconfig(void) capfilter = 0; #ifdef HAVE_SSE - capfilter |= CPU_CAP_SSE; + capfilter |= CPU_CAP_SSE | CPU_CAP_SSE2; #endif #ifdef HAVE_NEON capfilter |= CPU_CAP_NEON; @@ -872,6 +872,8 @@ static void alc_initconfig(void) len = (next ? ((size_t)(next-str)) : strlen(str)); if(strncasecmp(str, "sse", len) == 0) capfilter &= ~CPU_CAP_SSE; + else if(strncasecmp(str, "sse2", len) == 0) + capfilter &= ~CPU_CAP_SSE2; else if(strncasecmp(str, "neon", len) == 0) capfilter &= ~CPU_CAP_NEON; else diff --git a/Alc/helpers.c b/Alc/helpers.c index 9e347396..e16a907d 100644 --- a/Alc/helpers.c +++ b/Alc/helpers.c @@ -106,7 +106,11 @@ void FillCPUCaps(ALuint capfilter) { #ifdef bit_SSE if((cpuinf[0].regs[3]&bit_SSE)) + { caps |= CPU_CAP_SSE; + if((cpuinf[0].regs[3]&bit_SSE2)) + caps |= CPU_CAP_SSE2; + } #endif } } @@ -119,7 +123,11 @@ void FillCPUCaps(ALuint capfilter) else { if(IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE)) + { caps |= CPU_CAP_SSE; + if(IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE)) + caps |= CPU_CAP_SSE2; + } } #endif #ifdef HAVE_NEON @@ -127,9 +135,10 @@ void FillCPUCaps(ALuint capfilter) caps |= CPU_CAP_NEON; #endif - TRACE("Got caps:%s%s%s\n", ((caps&CPU_CAP_SSE)?((capfilter&CPU_CAP_SSE)?" SSE":" (SSE)"):""), - ((caps&CPU_CAP_NEON)?((capfilter&CPU_CAP_NEON)?" Neon":" (Neon)"):""), - ((!caps)?" -none-":"")); + TRACE("Got caps:%s%s%s%s\n", ((caps&CPU_CAP_SSE)?((capfilter&CPU_CAP_SSE)?" SSE":" (SSE)"):""), + ((caps&CPU_CAP_SSE)?((capfilter&CPU_CAP_SSE2)?" SSE2":" (SSE2)"):""), + ((caps&CPU_CAP_NEON)?((capfilter&CPU_CAP_NEON)?" Neon":" (Neon)"):""), + ((!caps)?" -none-":"")); CPUCapFlags = caps & capfilter; } @@ -207,6 +216,8 @@ void SetMixerFPUMode(FPUCtl *ctl) ctl->sse_state = sseState; sseState |= 0x6000; /* set round-to-zero */ sseState |= 0x8000; /* set flush-to-zero */ + if((CPUCapFlags&CPU_CAP_SSE2)) + sseState |= 0x0040; /* set denormals-are-zero */ __asm__ __volatile__("ldmxcsr %0" : : "m" (*&sseState)); } #endif diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c85be15..17bd5263 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,10 +26,10 @@ PROJECT(OpenAL C) SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE) -OPTION(ALSOFT_CPUEXT_SSE "Check for SSE CPU extensions" ON) +OPTION(ALSOFT_CPUEXT_SSE "Check for SSE/SSE2 CPU extensions" ON) OPTION(ALSOFT_CPUEXT_NEON "Check for ARM Neon CPU extensions" ON) -OPTION(ALSOFT_REQUIRE_SSE "Require SSE CPU extensions" OFF) +OPTION(ALSOFT_REQUIRE_SSE "Require SSE/SSE2 CPU extensions" OFF) OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon CPU extensions" OFF) diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 6ad7382e..743242d7 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -837,7 +837,8 @@ extern ALint RTPrioLevel; extern ALuint CPUCapFlags; enum { CPU_CAP_SSE = 1<<0, - CPU_CAP_NEON = 1<<1, + CPU_CAP_SSE2 = 1<<1, + CPU_CAP_NEON = 1<<2, }; void FillCPUCaps(ALuint capfilter); diff --git a/alsoftrc.sample b/alsoftrc.sample index c536493a..cfd333da 100644 --- a/alsoftrc.sample +++ b/alsoftrc.sample @@ -14,7 +14,7 @@ ## disable-cpu-exts: # Disables use of the listed CPU extensions. Certain methods may utilize CPU # extensions when detected, and this option is useful for preventing those -# extensions from being used. The available extensions are: sse, neon. +# extensions from being used. The available extensions are: sse, sse2, neon. # Specifying 'all' disables use of all extensions. #disable-cpu-exts = |