aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c32
-rw-r--r--Alc/helpers.c19
-rw-r--r--OpenAL32/Include/alMain.h4
-rw-r--r--alsoftrc.sample7
4 files changed, 52 insertions, 10 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index b017c480..e664d25a 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -769,6 +769,7 @@ static void alc_init(void)
static void alc_initconfig(void)
{
const char *devs, *str;
+ ALuint capfilter;
float valf;
int i, n;
@@ -790,7 +791,36 @@ static void alc_initconfig(void)
ReadALConfig();
- FillCPUCaps();
+ capfilter = CPU_CAP_ALL;
+ if(ConfigValueStr(NULL, "disable-cpu-exts", &str))
+ {
+ if(strcasecmp(str, "all") == 0)
+ capfilter = 0;
+ else
+ {
+ size_t len;
+ const char *next = str;
+
+ i = 0;
+ do {
+ str = next;
+ next = strchr(str, ',');
+
+ while(isspace(str[0]))
+ str++;
+ if(!str[0] || str[0] == ',')
+ continue;
+
+ len = (next ? ((size_t)(next-str)) : strlen(str));
+ if(strncasecmp(str, "neon", len) == 0)
+ capfilter &= ~CPU_CAP_NEON;
+ else
+ WARN("Invalid CPU extension \"%s\"\n", str);
+ } while(next++);
+ }
+ }
+ FillCPUCaps(capfilter);
+
InitHrtf();
#ifdef _WIN32
diff --git a/Alc/helpers.c b/Alc/helpers.c
index 6051573e..d963f3a8 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -63,8 +63,10 @@ DEFINE_DEVPROPKEY(DEVPKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80,
ALuint CPUCapFlags = 0;
-void FillCPUCaps(void)
+void FillCPUCaps(ALuint capfilter)
{
+ ALuint caps = 0;
+
#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
/* FIXME: We really should get this for all available CPUs in case different
* CPUs have different caps (is that possible on one machine?). */
@@ -90,11 +92,11 @@ void FillCPUCaps(void)
{
#ifdef bit_MMX
if((cpuinf[0].regs[3]&bit_MMX))
- CPUCapFlags |= CPU_CAP_MMX;
+ caps |= CPU_CAP_MMX;
#endif
#ifdef bit_SSE
if((cpuinf[0].regs[3]&bit_SSE))
- CPUCapFlags |= CPU_CAP_SSE;
+ caps |= CPU_CAP_SSE;
#endif
}
}
@@ -102,13 +104,14 @@ void FillCPUCaps(void)
#endif
#ifdef HAVE_ARM_NEON_H
/* Assume Neon support if compiled with it */
- CPUCapFlags |= CPU_CAP_NEON;
+ caps |= CPU_CAP_NEON;
#endif
- TRACE("Got caps:%s%s%s%s\n", ((CPUCapFlags&CPU_CAP_MMX)?" MMX":""),
- ((CPUCapFlags&CPU_CAP_SSE)?" SSE":""),
- ((CPUCapFlags&CPU_CAP_NEON)?" Neon":""),
- ((!CPUCapFlags)?" (none)":""));
+ TRACE("Got caps:%s%s%s%s\n", ((caps&CPU_CAP_MMX)?((capfilter&CPU_CAP_MMX)?" MMX":" (MMX)"):""),
+ ((caps&CPU_CAP_SSE)?((capfilter&CPU_CAP_SSE)?" SSE":" (SSE)"):""),
+ ((caps&CPU_CAP_NEON)?((capfilter&CPU_CAP_NEON)?" Neon":" (Neon)"):""),
+ ((!caps)?" (none)":""));
+ CPUCapFlags = caps & capfilter;
}
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 1f73ad72..f05d7316 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -768,9 +768,11 @@ enum {
CPU_CAP_MMX = 1<<0,
CPU_CAP_SSE = 1<<1,
CPU_CAP_NEON = 1<<3,
+
+ CPU_CAP_ALL = CPU_CAP_MMX|CPU_CAP_SSE|CPU_CAP_NEON
};
-void FillCPUCaps(void);
+void FillCPUCaps(ALuint capfilter);
/**
diff --git a/alsoftrc.sample b/alsoftrc.sample
index 58746c8f..affcc2fa 100644
--- a/alsoftrc.sample
+++ b/alsoftrc.sample
@@ -11,6 +11,13 @@
# possible). Note: options that are left unset may default to app- or system-
# specified values. These are the current available settings:
+## 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: neon. Specifying
+# 'all' disables use of all extensions.
+#disable-cpu-exts =
+
## channels:
# Sets the output channel configuration. If left unspecified, one will try to
# be detected from the system, and defaulting to stereo. The available values