Commit 03df110f authored by bitplane's avatar bitplane

disabled windows hires timer on multi-cpu systems when the process is running...

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
parent 37d23638
Changes in version 1.4 (... 2007) 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 - 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 written opengl shaders that use render targets then you'll need to change your
texture coordinates accordingly. texture coordinates accordingly.
......
...@@ -78,8 +78,31 @@ namespace os ...@@ -78,8 +78,31 @@ namespace os
BOOL HighPerformanceTimerSupport = FALSE; BOOL HighPerformanceTimerSupport = FALSE;
void Timer::initTimer() void Timer::initTimer()
{
// 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); HighPerformanceTimerSupport = QueryPerformanceFrequency(&HighPerformanceFreq);
}
else
{
HighPerformanceTimerSupport = false;
}
initVirtualTimer(); initVirtualTimer();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment