disabled windows hires timer on multi-cpu systems when the process is running on more than one cpu. bug reported by _Alex`86_ and Halan.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@804 dfc29bdd-3216-0410-991c-e03cc46cb475
master
bitplane 2007-07-21 14:05:11 +00:00
parent 37d2363843
commit 03df110fc6
2 changed files with 28 additions and 1 deletions

View File

@ -1,5 +1,9 @@
Changes in version 1.4 (... 2007)
- Hires timers are disabled on windows systems with more than one CPU, due to bugs
in the BIOS of many multi-core motherboards. To enable hires timers in your project,
use SetProcessAffinityMask to set to use only one CPU before creating the device.
- OpenGL render targets now the same way up as the other drivers. If you have
written opengl shaders that use render targets then you'll need to change your
texture coordinates accordingly.

View File

@ -79,7 +79,30 @@ namespace os
void Timer::initTimer()
{
HighPerformanceTimerSupport = QueryPerformanceFrequency(&HighPerformanceFreq);
// disable hires timer on multiple core systems, bios bugs result in bad hires timers.
SYSTEM_INFO sysinfo;
DWORD affinity, sysaffinity;
GetSystemInfo(&sysinfo);
s32 affinityCount = 0;
// count the processors that can be used by this process
if (GetProcessAffinityMask( GetCurrentProcess(), &affinity, &sysaffinity ))
{
for (u32 i=0; i<32; ++i)
{
if ((1<<i) & affinity)
affinityCount++;
}
}
if (sysinfo.dwNumberOfProcessors == 1 || affinityCount == 1)
{
HighPerformanceTimerSupport = QueryPerformanceFrequency(&HighPerformanceFreq);
}
else
{
HighPerformanceTimerSupport = false;
}
initVirtualTimer();
}