detect if AVX is supported
This commit is contained in:
parent
537b8605b0
commit
f4ee6128c4
5 changed files with 25 additions and 2 deletions
17
src/utils.c
17
src/utils.c
|
@ -1,4 +1,5 @@
|
|||
#include <windows.h>
|
||||
#include <intrin.h>
|
||||
#include "ddraw.h"
|
||||
#include "debug.h"
|
||||
#include "dd.h"
|
||||
|
@ -10,6 +11,22 @@
|
|||
#include "config.h"
|
||||
|
||||
|
||||
BOOL util_is_avx_supported()
|
||||
{
|
||||
unsigned int xcr0 = 0;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
xcr0 = (unsigned int)_xgetbv(_XCR_XFEATURE_ENABLED_MASK);
|
||||
#else
|
||||
__asm__("xgetbv" : "=a" (xcr0) : "c" (0) : "%edx");
|
||||
#endif
|
||||
|
||||
int info[4] = { 0 };
|
||||
__cpuid(info, 1);
|
||||
|
||||
return (info[2] & (1 << 27)) && (info[2] & (1 << 28)) && (xcr0 & 6);
|
||||
}
|
||||
|
||||
void util_limit_game_ticks()
|
||||
{
|
||||
if (g_ddraw->ticks_limiter.htimer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue