Removed SDL_CPUINFO_DISABLED
CPU info is a core part of the SDL API, and shouldn't be disabledmain
parent
52d6587084
commit
6e1b11368d
|
@ -211,7 +211,6 @@ if(EMSCRIPTEN)
|
||||||
set(SDL_ASSEMBLY_DEFAULT OFF)
|
set(SDL_ASSEMBLY_DEFAULT OFF)
|
||||||
set(SDL_SHARED_AVAILABLE OFF)
|
set(SDL_SHARED_AVAILABLE OFF)
|
||||||
set(SDL_ATOMIC_DEFAULT OFF)
|
set(SDL_ATOMIC_DEFAULT OFF)
|
||||||
set(SDL_CPUINFO_DEFAULT OFF)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(VITA OR PSP OR PS2 OR N3DS OR RISCOS)
|
if(VITA OR PSP OR PS2 OR N3DS OR RISCOS)
|
||||||
|
@ -250,7 +249,6 @@ set(SDL_SUBSYSTEMS
|
||||||
Threads
|
Threads
|
||||||
Timers
|
Timers
|
||||||
File
|
File
|
||||||
CPUinfo
|
|
||||||
Filesystem
|
Filesystem
|
||||||
Sensor
|
Sensor
|
||||||
Locale
|
Locale
|
||||||
|
|
|
@ -258,7 +258,6 @@
|
||||||
/* Allow disabling of core subsystems */
|
/* Allow disabling of core subsystems */
|
||||||
#cmakedefine SDL_ATOMIC_DISABLED @SDL_ATOMIC_DISABLED@
|
#cmakedefine SDL_ATOMIC_DISABLED @SDL_ATOMIC_DISABLED@
|
||||||
#cmakedefine SDL_AUDIO_DISABLED @SDL_AUDIO_DISABLED@
|
#cmakedefine SDL_AUDIO_DISABLED @SDL_AUDIO_DISABLED@
|
||||||
#cmakedefine SDL_CPUINFO_DISABLED @SDL_CPUINFO_DISABLED@
|
|
||||||
#cmakedefine SDL_FILE_DISABLED @SDL_FILE_DISABLED@
|
#cmakedefine SDL_FILE_DISABLED @SDL_FILE_DISABLED@
|
||||||
#cmakedefine SDL_JOYSTICK_DISABLED @SDL_JOYSTICK_DISABLED@
|
#cmakedefine SDL_JOYSTICK_DISABLED @SDL_JOYSTICK_DISABLED@
|
||||||
#cmakedefine SDL_HAPTIC_DISABLED @SDL_HAPTIC_DISABLED@
|
#cmakedefine SDL_HAPTIC_DISABLED @SDL_HAPTIC_DISABLED@
|
||||||
|
|
|
@ -156,7 +156,6 @@
|
||||||
/* SDL internal assertion support */
|
/* SDL internal assertion support */
|
||||||
/* #undef SDL_DEFAULT_ASSERT_LEVEL */
|
/* #undef SDL_DEFAULT_ASSERT_LEVEL */
|
||||||
|
|
||||||
#define SDL_CPUINFO_DISABLED 1
|
|
||||||
#define SDL_HAPTIC_DISABLED 1
|
#define SDL_HAPTIC_DISABLED 1
|
||||||
#define SDL_HIDAPI_DISABLED 1
|
#define SDL_HIDAPI_DISABLED 1
|
||||||
#ifndef __EMSCRIPTEN_PTHREADS__
|
#ifndef __EMSCRIPTEN_PTHREADS__
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
// TODO: NEON is disabled until https://github.com/libsdl-org/SDL/issues/8352 can be fixed
|
// TODO: NEON is disabled until https://github.com/libsdl-org/SDL/issues/8352 can be fixed
|
||||||
#undef SDL_NEON_INTRINSICS
|
#undef SDL_NEON_INTRINSICS
|
||||||
|
|
||||||
#ifndef SDL_CPUINFO_DISABLED
|
#ifndef __EMSCRIPTEN__
|
||||||
#if defined(__x86_64__) && defined(SDL_SSE2_INTRINSICS)
|
#if defined(__x86_64__) && defined(SDL_SSE2_INTRINSICS)
|
||||||
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 // x86_64 guarantees SSE2.
|
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 // x86_64 guarantees SSE2.
|
||||||
#elif defined(__MACOS__) && defined(SDL_SSE2_INTRINSICS)
|
#elif defined(__MACOS__) && defined(SDL_SSE2_INTRINSICS)
|
||||||
|
@ -35,10 +35,10 @@
|
||||||
#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && defined(SDL_NEON_INTRINSICS)
|
#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && defined(SDL_NEON_INTRINSICS)
|
||||||
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 // All Apple ARMv7 chips promise NEON support.
|
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 // All Apple ARMv7 chips promise NEON support.
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif /* __EMSCRIPTEN__ */
|
||||||
|
|
||||||
// Set to zero if platform is guaranteed to use a SIMD codepath here.
|
// Set to zero if platform is guaranteed to use a SIMD codepath here.
|
||||||
#if !defined(NEED_SCALAR_CONVERTER_FALLBACKS) || defined(SDL_CPUINFO_DISABLED)
|
#if !defined(NEED_SCALAR_CONVERTER_FALLBACKS)
|
||||||
#define NEED_SCALAR_CONVERTER_FALLBACKS 1
|
#define NEED_SCALAR_CONVERTER_FALLBACKS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ static int CPU_haveCPUID(void)
|
||||||
int has_CPUID = 0;
|
int has_CPUID = 0;
|
||||||
|
|
||||||
/* *INDENT-OFF* */ /* clang-format off */
|
/* *INDENT-OFF* */ /* clang-format off */
|
||||||
#ifndef SDL_CPUINFO_DISABLED
|
#ifndef __EMSCRIPTEN__
|
||||||
#if (defined(__GNUC__) || defined(__llvm__)) && defined(__i386__)
|
#if (defined(__GNUC__) || defined(__llvm__)) && defined(__i386__)
|
||||||
__asm__ (
|
__asm__ (
|
||||||
" pushfl # Get original EFLAGS \n"
|
" pushfl # Get original EFLAGS \n"
|
||||||
|
@ -209,7 +209,7 @@ done:
|
||||||
"1: \n"
|
"1: \n"
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif /* !__EMSCRIPTEN__ */
|
||||||
/* *INDENT-ON* */ /* clang-format on */
|
/* *INDENT-ON* */ /* clang-format on */
|
||||||
return has_CPUID;
|
return has_CPUID;
|
||||||
}
|
}
|
||||||
|
@ -439,9 +439,7 @@ static int CPU_haveNEON(void)
|
||||||
{
|
{
|
||||||
/* The way you detect NEON is a privileged instruction on ARM, so you have
|
/* The way you detect NEON is a privileged instruction on ARM, so you have
|
||||||
query the OS kernel in a platform-specific way. :/ */
|
query the OS kernel in a platform-specific way. :/ */
|
||||||
#ifdef SDL_CPUINFO_DISABLED
|
#if (defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__)) && (defined(_M_ARM) || defined(_M_ARM64))
|
||||||
return 0; /* disabled */
|
|
||||||
#elif (defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__)) && (defined(_M_ARM) || defined(_M_ARM64))
|
|
||||||
/* Visual Studio, for ARM, doesn't define __ARM_ARCH. Handle this first. */
|
/* Visual Studio, for ARM, doesn't define __ARM_ARCH. Handle this first. */
|
||||||
/* Seems to have been removed */
|
/* Seems to have been removed */
|
||||||
#ifndef PF_ARM_NEON_INSTRUCTIONS_AVAILABLE
|
#ifndef PF_ARM_NEON_INSTRUCTIONS_AVAILABLE
|
||||||
|
@ -498,6 +496,8 @@ static int CPU_haveNEON(void)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#elif defined(__EMSCRIPTEN__)
|
||||||
|
return 0;
|
||||||
#else
|
#else
|
||||||
#warning SDL_HasNEON is not implemented for this ARM platform. Write me.
|
#warning SDL_HasNEON is not implemented for this ARM platform. Write me.
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -618,7 +618,6 @@ static int SDL_CPUCount = 0;
|
||||||
int SDL_GetCPUCount(void)
|
int SDL_GetCPUCount(void)
|
||||||
{
|
{
|
||||||
if (!SDL_CPUCount) {
|
if (!SDL_CPUCount) {
|
||||||
#ifndef SDL_CPUINFO_DISABLED
|
|
||||||
#if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
|
#if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
|
||||||
if (SDL_CPUCount <= 0) {
|
if (SDL_CPUCount <= 0) {
|
||||||
SDL_CPUCount = (int)sysconf(_SC_NPROCESSORS_ONLN);
|
SDL_CPUCount = (int)sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
|
@ -636,7 +635,6 @@ int SDL_GetCPUCount(void)
|
||||||
GetSystemInfo(&info);
|
GetSystemInfo(&info);
|
||||||
SDL_CPUCount = info.dwNumberOfProcessors;
|
SDL_CPUCount = info.dwNumberOfProcessors;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
/* There has to be at least 1, right? :) */
|
/* There has to be at least 1, right? :) */
|
||||||
if (SDL_CPUCount <= 0) {
|
if (SDL_CPUCount <= 0) {
|
||||||
|
@ -1003,7 +1001,6 @@ static int SDL_SystemRAM = 0;
|
||||||
int SDL_GetSystemRAM(void)
|
int SDL_GetSystemRAM(void)
|
||||||
{
|
{
|
||||||
if (!SDL_SystemRAM) {
|
if (!SDL_SystemRAM) {
|
||||||
#ifndef SDL_CPUINFO_DISABLED
|
|
||||||
#if defined(HAVE_SYSCONF) && defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
|
#if defined(HAVE_SYSCONF) && defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
|
||||||
if (SDL_SystemRAM <= 0) {
|
if (SDL_SystemRAM <= 0) {
|
||||||
SDL_SystemRAM = (int)((Sint64)sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / (1024 * 1024));
|
SDL_SystemRAM = (int)((Sint64)sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / (1024 * 1024));
|
||||||
|
@ -1072,7 +1069,6 @@ int SDL_GetSystemRAM(void)
|
||||||
SDL_SystemRAM = (int)SDL_round((info.max_pages + info.ignored_pages > 0 ? info.ignored_pages : 0) * B_PAGE_SIZE / 1048576.0);
|
SDL_SystemRAM = (int)SDL_round((info.max_pages + info.ignored_pages > 0 ? info.ignored_pages : 0) * B_PAGE_SIZE / 1048576.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return SDL_SystemRAM;
|
return SDL_SystemRAM;
|
||||||
|
|
Loading…
Reference in New Issue