Tier0: split CPU feature checks into multiple functions

This commit is contained in:
Kawe Mazidjatari 2024-04-05 19:35:41 +02:00
parent 7a331284eb
commit f18829a487
2 changed files with 32 additions and 1 deletions

View File

@ -575,7 +575,7 @@ const CPUInformation& GetCPUInformation(void)
return pi;
}
void CheckSystemCPU()
void CheckSystemCPUForSSE2()
{
const CPUInformation& pi = GetCPUInformation();
@ -586,6 +586,12 @@ void CheckSystemCPU()
TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF);
}
}
}
void CheckSystemCPUForSSE3()
{
const CPUInformation& pi = GetCPUInformation();
if (!pi.m_bSSE3)
{
if (MessageBoxA(NULL, "SSE3 is required.", "Unsupported CPU", MB_ICONERROR | MB_OK))
@ -593,6 +599,12 @@ void CheckSystemCPU()
TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF);
}
}
}
void CheckSystemCPUForSupplementalSSE3()
{
const CPUInformation& pi = GetCPUInformation();
if (!pi.m_bSSSE3)
{
if (MessageBoxA(NULL, "SSSE3 (Supplemental SSE3 Instructions) is required.", "Unsupported CPU", MB_ICONERROR | MB_OK))
@ -600,6 +612,12 @@ void CheckSystemCPU()
TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF);
}
}
}
void CheckSystemCPUForPopCount()
{
const CPUInformation& pi = GetCPUInformation();
if (!pi.m_bPOPCNT)
{
if (MessageBoxA(NULL, "POPCNT is required.", "Unsupported CPU", MB_ICONERROR | MB_OK))
@ -608,3 +626,11 @@ void CheckSystemCPU()
}
}
}
void CheckSystemCPU()
{
CheckSystemCPUForSSE2();
CheckSystemCPUForSSE3();
CheckSystemCPUForSupplementalSSE3();
CheckSystemCPUForPopCount();
}

View File

@ -130,6 +130,11 @@ const char* GetProcessorBrand(bool bRemovePadding);
const CPUInformation& GetCPUInformation(void);
void CheckSystemCPUForSSE2();
void CheckSystemCPUForSSE3();
void CheckSystemCPUForSupplementalSSE3();
void CheckSystemCPUForPopCount();
void CheckSystemCPU();
#endif // CPU_H