Added creation parameter to disable highres timers. Patch submitted by tonic.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3397 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2010-09-07 11:54:13 +00:00
parent da27ae4f3f
commit 0058bfc4fa
6 changed files with 24 additions and 6 deletions

View File

@ -1,5 +1,11 @@
Changes in 1.8 (??.0?.2010)
- Add creation parameter which allows to disable highres timers on Windows upon device creation.
- Several transparency setup bugs fixed.
- Added a method to get real time and date in a human readable struct
- Add IGUIElement::bringToBack (patch written by DtD, although I'm to blame for the function-name)
- BurningVideo

View File

@ -38,6 +38,7 @@ namespace irr
WindowId(0),
LoggingLevel(ELL_INFORMATION),
DisplayAdapter(0),
UsePerformanceTimer(true),
SDK_version_do_not_use(IRRLICHT_SDK_VERSION)
{
}
@ -66,6 +67,7 @@ namespace irr
WindowId = other.WindowId;
LoggingLevel = other.LoggingLevel;
DisplayAdapter = other.DisplayAdapter;
UsePerformanceTimer = other.UsePerformanceTimer;
return *this;
}
@ -245,6 +247,13 @@ namespace irr
/** So far only supported on D3D */
u32 DisplayAdapter;
//! Enables use of high performance timers on Windows platform.
/** When performance timers are not used, standard GetTickCount()
is used instead which usually has worse resolution, but also less
problems with speed stepping and other techniques.
*/
bool UsePerformanceTimer;
//! Don't use or change this parameter.
/** Always set it to IRRLICHT_SDK_VERSION, which is done by default.
This is needed for sdk version checks. */

View File

@ -22,7 +22,7 @@ CIrrDeviceStub::CIrrDeviceStub(const SIrrlichtCreationParameters& params)
FileSystem(0), InputReceivingSceneManager(0), CreationParams(params),
Close(false)
{
Timer = new CTimer();
Timer = new CTimer(params.UsePerformanceTimer);
if (os::Printer::Logger)
{
os::Printer::Logger->grab();

View File

@ -15,9 +15,9 @@ namespace irr
{
public:
CTimer()
CTimer(bool usePerformanceTimer=true)
{
os::Timer::initTimer();
os::Timer::initTimer(usePerformanceTimer);
}
//! Returns current real time in milliseconds of the system.

View File

@ -81,7 +81,7 @@ namespace os
static BOOL HighPerformanceTimerSupport = FALSE;
static BOOL MultiCore = FALSE;
void Timer::initTimer()
void Timer::initTimer(bool usePerformanceTimer)
{
#if !defined(_WIN32_WCE) && !defined (_IRR_XBOX_PLATFORM_)
// disable hires timer on multiple core systems, bios bugs result in bad hires timers.
@ -89,7 +89,10 @@ namespace os
GetSystemInfo(&sysinfo);
MultiCore = (sysinfo.dwNumberOfProcessors > 1);
#endif
HighPerformanceTimerSupport = QueryPerformanceFrequency(&HighPerformanceFreq);
if (usePerformanceTimer)
HighPerformanceTimerSupport = QueryPerformanceFrequency(&HighPerformanceFreq);
else
HighPerformanceTimerSupport = FALSE;
initVirtualTimer();
}

View File

@ -72,7 +72,7 @@ namespace os
static ITimer::RealTimeDate getRealTimeAndDate();
//! initializes the real timer
static void initTimer();
static void initTimer(bool usePerformanceTimer=true);
//! sets the current virtual (game) time
static void setTime(u32 time);