Ensure detectCPU() called when requested

This commit is contained in:
Jack Andersen 2016-10-01 13:19:48 -10:00
parent e3fcd6c481
commit 7185e13abe
1 changed files with 4 additions and 4 deletions

View File

@ -11,6 +11,7 @@
namespace zeus namespace zeus
{ {
static bool isCPUInit = false;
static CPUInfo g_cpuFeatures; static CPUInfo g_cpuFeatures;
void getCpuInfo(int level, int regs[4]) void getCpuInfo(int level, int regs[4])
@ -27,8 +28,7 @@ void getCpuInfo(int level, int regs[4])
void detectCPU() void detectCPU()
{ {
#if !GEKKO #if !GEKKO
static bool isInit = false; if (isCPUInit)
if (isInit)
return; return;
int regs[4]; int regs[4];
@ -62,11 +62,11 @@ void detectCPU()
memset((bool*)&g_cpuFeatures.SSE41, ((regs[2] & 0x00080000) != 0), 1); memset((bool*)&g_cpuFeatures.SSE41, ((regs[2] & 0x00080000) != 0), 1);
memset((bool*)&g_cpuFeatures.SSE42, ((regs[2] & 0x00100000) != 0), 1); memset((bool*)&g_cpuFeatures.SSE42, ((regs[2] & 0x00100000) != 0), 1);
isInit = true; isCPUInit = true;
#endif #endif
} }
const CPUInfo& cpuFeatures() { return g_cpuFeatures; } const CPUInfo& cpuFeatures() { detectCPU(); return g_cpuFeatures; }
CTransform lookAt(const CVector3f& pos, const CVector3f& lookPos, const CVector3f& up) CTransform lookAt(const CVector3f& pos, const CVector3f& lookPos, const CVector3f& up)
{ {