SDL
2.0
|
Go to the source code of this file.
Macros | |
#define | CPU_HAS_RDTSC 0x00000001 |
#define | CPU_HAS_ALTIVEC 0x00000002 |
#define | CPU_HAS_MMX 0x00000004 |
#define | CPU_HAS_3DNOW 0x00000008 |
#define | CPU_HAS_SSE 0x00000010 |
#define | CPU_HAS_SSE2 0x00000020 |
#define | CPU_HAS_SSE3 0x00000040 |
#define | CPU_HAS_SSE41 0x00000100 |
#define | CPU_HAS_SSE42 0x00000200 |
#define | CPU_HAS_AVX 0x00000400 |
#define | CPU_HAS_AVX2 0x00000800 |
#define | CPU_HAS_NEON 0x00001000 |
#define | cpuid(func, a, b, c, d) do { a = b = c = d = 0; (void) a; (void) b; (void) c; (void) d; } while (0) |
#define | CPU_haveRDTSC() (CPU_CPUIDFeatures[3] & 0x00000010) |
#define | CPU_haveMMX() (CPU_CPUIDFeatures[3] & 0x00800000) |
#define | CPU_haveSSE() (CPU_CPUIDFeatures[3] & 0x02000000) |
#define | CPU_haveSSE2() (CPU_CPUIDFeatures[3] & 0x04000000) |
#define | CPU_haveSSE3() (CPU_CPUIDFeatures[2] & 0x00000001) |
#define | CPU_haveSSE41() (CPU_CPUIDFeatures[2] & 0x00080000) |
#define | CPU_haveSSE42() (CPU_CPUIDFeatures[2] & 0x00100000) |
#define | CPU_haveAVX() (CPU_OSSavesYMM && (CPU_CPUIDFeatures[2] & 0x10000000)) |
#define | CPU_FEATURE_AVAILABLE(f) ((SDL_GetCPUFeatures() & f) ? SDL_TRUE : SDL_FALSE) |
Functions | |
static int | CPU_haveCPUID (void) |
static void | CPU_calcCPUIDFeatures (void) |
static int | CPU_haveAltiVec (void) |
static int | CPU_haveNEON (void) |
static int | CPU_have3DNow (void) |
static int | CPU_haveAVX2 (void) |
int | SDL_GetCPUCount (void) |
static const char * | SDL_GetCPUType (void) |
int | SDL_GetCPUCacheLineSize (void) |
static Uint32 | SDL_GetCPUFeatures (void) |
SDL_bool | SDL_HasRDTSC (void) |
SDL_bool | SDL_HasAltiVec (void) |
SDL_bool | SDL_HasMMX (void) |
SDL_bool | SDL_Has3DNow (void) |
SDL_bool | SDL_HasSSE (void) |
SDL_bool | SDL_HasSSE2 (void) |
SDL_bool | SDL_HasSSE3 (void) |
SDL_bool | SDL_HasSSE41 (void) |
SDL_bool | SDL_HasSSE42 (void) |
SDL_bool | SDL_HasAVX (void) |
SDL_bool | SDL_HasAVX2 (void) |
SDL_bool | SDL_HasNEON (void) |
int | SDL_GetSystemRAM (void) |
Variables | |
static int | CPU_CPUIDFeatures [4] |
static int | CPU_CPUIDMaxFunction = 0 |
static SDL_bool | CPU_OSSavesYMM = SDL_FALSE |
static int | SDL_CPUCount = 0 |
static Uint32 | SDL_CPUFeatures = 0xFFFFFFFF |
static int | SDL_SystemRAM = 0 |
#define CPU_FEATURE_AVAILABLE | ( | f | ) | ((SDL_GetCPUFeatures() & f) ? SDL_TRUE : SDL_FALSE) |
Definition at line 621 of file SDL_cpuinfo.c.
Referenced by SDL_Has3DNow(), SDL_HasAltiVec(), SDL_HasAVX(), SDL_HasAVX2(), SDL_HasMMX(), SDL_HasNEON(), SDL_HasRDTSC(), SDL_HasSSE(), SDL_HasSSE2(), SDL_HasSSE3(), SDL_HasSSE41(), and SDL_HasSSE42().
#define CPU_HAS_3DNOW 0x00000008 |
Definition at line 82 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures(), and SDL_Has3DNow().
#define CPU_HAS_ALTIVEC 0x00000002 |
Definition at line 80 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures(), and SDL_HasAltiVec().
#define CPU_HAS_AVX 0x00000400 |
Definition at line 88 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures(), and SDL_HasAVX().
#define CPU_HAS_AVX2 0x00000800 |
Definition at line 89 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures(), and SDL_HasAVX2().
#define CPU_HAS_MMX 0x00000004 |
Definition at line 81 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures(), and SDL_HasMMX().
#define CPU_HAS_NEON 0x00001000 |
Definition at line 90 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures(), and SDL_HasNEON().
#define CPU_HAS_RDTSC 0x00000001 |
Definition at line 79 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures(), and SDL_HasRDTSC().
#define CPU_HAS_SSE 0x00000010 |
Definition at line 83 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE().
#define CPU_HAS_SSE2 0x00000020 |
Definition at line 84 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE2().
#define CPU_HAS_SSE3 0x00000040 |
Definition at line 85 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE3().
#define CPU_HAS_SSE41 0x00000100 |
Definition at line 86 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE41().
#define CPU_HAS_SSE42 0x00000200 |
Definition at line 87 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures(), and SDL_HasSSE42().
#define CPU_haveAVX | ( | ) | (CPU_OSSavesYMM && (CPU_CPUIDFeatures[2] & 0x10000000)) |
Definition at line 389 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures().
#define CPU_haveMMX | ( | ) | (CPU_CPUIDFeatures[3] & 0x00800000) |
Definition at line 383 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures().
#define CPU_haveRDTSC | ( | ) | (CPU_CPUIDFeatures[3] & 0x00000010) |
Definition at line 382 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures().
#define CPU_haveSSE | ( | ) | (CPU_CPUIDFeatures[3] & 0x02000000) |
Definition at line 384 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures().
#define CPU_haveSSE2 | ( | ) | (CPU_CPUIDFeatures[3] & 0x04000000) |
Definition at line 385 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures().
#define CPU_haveSSE3 | ( | ) | (CPU_CPUIDFeatures[2] & 0x00000001) |
Definition at line 386 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures().
#define CPU_haveSSE41 | ( | ) | (CPU_CPUIDFeatures[2] & 0x00080000) |
Definition at line 387 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures().
#define CPU_haveSSE42 | ( | ) | (CPU_CPUIDFeatures[2] & 0x00100000) |
Definition at line 388 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures().
#define cpuid | ( | func, | |
a, | |||
b, | |||
c, | |||
d | |||
) | do { a = b = c = d = 0; (void) a; (void) b; (void) c; (void) d; } while (0) |
Definition at line 242 of file SDL_cpuinfo.c.
Referenced by CPU_calcCPUIDFeatures(), CPU_have3DNow(), CPU_haveAVX2(), SDL_GetCPUCacheLineSize(), and SDL_GetCPUType().
Definition at line 251 of file SDL_cpuinfo.c.
References CPU_CPUIDFeatures, CPU_CPUIDMaxFunction, CPU_haveCPUID(), CPU_OSSavesYMM, cpuid, d, SDL_FALSE, and SDL_TRUE.
Referenced by SDL_GetCPUFeatures(), and SDL_GetCPUType().
|
static |
Definition at line 369 of file SDL_cpuinfo.c.
References CPU_CPUIDMaxFunction, cpuid, and d.
Referenced by SDL_GetCPUFeatures().
|
static |
Definition at line 290 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures().
|
static |
Definition at line 392 of file SDL_cpuinfo.c.
References CPU_CPUIDMaxFunction, CPU_OSSavesYMM, cpuid, d, and void.
Referenced by SDL_GetCPUFeatures().
|
static |
|
static |
Definition at line 340 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures().
int SDL_GetCPUCacheLineSize | ( | void | ) |
This function returns the L1 cache line size of the CPU
This is useful for determining multi-threaded structure padding or SIMD prefetch sizes.
Definition at line 556 of file SDL_cpuinfo.c.
References cpuid, d, SDL_CACHELINE_SIZE, SDL_GetCPUType(), SDL_strcmp, and void.
Referenced by SDL_GetSystemRAM().
int SDL_GetCPUCount | ( | void | ) |
This function returns the number of CPU cores available.
Definition at line 406 of file SDL_cpuinfo.c.
References NULL, and SDL_CPUCount.
Referenced by SDL_GetSystemRAM().
Definition at line 576 of file SDL_cpuinfo.c.
References CPU_calcCPUIDFeatures(), CPU_HAS_3DNOW, CPU_HAS_ALTIVEC, CPU_HAS_AVX, CPU_HAS_AVX2, CPU_HAS_MMX, CPU_HAS_NEON, CPU_HAS_RDTSC, CPU_HAS_SSE, CPU_HAS_SSE2, CPU_HAS_SSE3, CPU_HAS_SSE41, CPU_HAS_SSE42, CPU_have3DNow(), CPU_haveAltiVec(), CPU_haveAVX, CPU_haveAVX2(), CPU_haveMMX, CPU_haveNEON(), CPU_haveRDTSC, CPU_haveSSE, CPU_haveSSE2, CPU_haveSSE3, CPU_haveSSE41, CPU_haveSSE42, and SDL_CPUFeatures.
|
static |
Definition at line 445 of file SDL_cpuinfo.c.
References CPU_calcCPUIDFeatures(), CPU_CPUIDMaxFunction, cpuid, d, i, SDL_strlcpy, and void.
Referenced by SDL_GetCPUCacheLineSize(), and SDL_GetSystemRAM().
int SDL_GetSystemRAM | ( | void | ) |
This function returns the amount of RAM configured in the system, in MB.
Definition at line 697 of file SDL_cpuinfo.c.
References main, NULL, SDL_GetCPUCacheLineSize(), SDL_GetCPUCount(), SDL_GetCPUType(), SDL_Has3DNow(), SDL_HasAltiVec(), SDL_HasAVX(), SDL_HasAVX2(), SDL_HasMMX(), SDL_HasNEON(), SDL_HasRDTSC(), SDL_HasSSE(), SDL_HasSSE2(), SDL_HasSSE3(), SDL_HasSSE41(), SDL_HasSSE42(), and SDL_SystemRAM.
This function returns true if the CPU has 3DNow! features.
Definition at line 641 of file SDL_cpuinfo.c.
References CPU_FEATURE_AVAILABLE, and CPU_HAS_3DNOW.
Referenced by SDL_GetSystemRAM().
This function returns true if the CPU has AltiVec features.
Definition at line 629 of file SDL_cpuinfo.c.
References CPU_FEATURE_AVAILABLE, and CPU_HAS_ALTIVEC.
Referenced by SDL_GetSystemRAM().
This function returns true if the CPU has AVX features.
Definition at line 677 of file SDL_cpuinfo.c.
References CPU_FEATURE_AVAILABLE, and CPU_HAS_AVX.
Referenced by SDL_GetSystemRAM().
This function returns true if the CPU has AVX2 features.
Definition at line 683 of file SDL_cpuinfo.c.
References CPU_FEATURE_AVAILABLE, and CPU_HAS_AVX2.
Referenced by SDL_GetSystemRAM().
This function returns true if the CPU has MMX features.
Definition at line 635 of file SDL_cpuinfo.c.
References CPU_FEATURE_AVAILABLE, and CPU_HAS_MMX.
Referenced by SDL_GetSystemRAM().
This function returns true if the CPU has NEON (ARM SIMD) features.
Definition at line 689 of file SDL_cpuinfo.c.
References CPU_FEATURE_AVAILABLE, and CPU_HAS_NEON.
Referenced by SDL_GetSystemRAM().
This function returns true if the CPU has the RDTSC instruction.
Definition at line 623 of file SDL_cpuinfo.c.
References CPU_FEATURE_AVAILABLE, and CPU_HAS_RDTSC.
Referenced by SDL_GetSystemRAM().
This function returns true if the CPU has SSE features.
Definition at line 647 of file SDL_cpuinfo.c.
References CPU_FEATURE_AVAILABLE, and CPU_HAS_SSE.
Referenced by SDL_GetSystemRAM().
This function returns true if the CPU has SSE2 features.
Definition at line 653 of file SDL_cpuinfo.c.
References CPU_FEATURE_AVAILABLE, and CPU_HAS_SSE2.
Referenced by SDL_GetSystemRAM().
This function returns true if the CPU has SSE3 features.
Definition at line 659 of file SDL_cpuinfo.c.
References CPU_FEATURE_AVAILABLE, and CPU_HAS_SSE3.
Referenced by SDL_GetSystemRAM().
This function returns true if the CPU has SSE4.1 features.
Definition at line 665 of file SDL_cpuinfo.c.
References CPU_FEATURE_AVAILABLE, and CPU_HAS_SSE41.
Referenced by SDL_GetSystemRAM().
This function returns true if the CPU has SSE4.2 features.
Definition at line 671 of file SDL_cpuinfo.c.
References CPU_FEATURE_AVAILABLE, and CPU_HAS_SSE42.
Referenced by SDL_GetSystemRAM().
|
static |
Definition at line 246 of file SDL_cpuinfo.c.
Referenced by CPU_calcCPUIDFeatures().
|
static |
Definition at line 247 of file SDL_cpuinfo.c.
Referenced by CPU_calcCPUIDFeatures(), CPU_have3DNow(), CPU_haveAVX2(), and SDL_GetCPUType().
Definition at line 248 of file SDL_cpuinfo.c.
Referenced by CPU_calcCPUIDFeatures(), and CPU_haveAVX2().
|
static |
Definition at line 403 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUCount().
|
static |
Definition at line 573 of file SDL_cpuinfo.c.
Referenced by SDL_GetCPUFeatures().
|
static |
Definition at line 694 of file SDL_cpuinfo.c.
Referenced by SDL_GetSystemRAM().