Commit 0058bfc4 authored by hybrid's avatar hybrid

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
parent da27ae4f
Changes in 1.8 (??.0?.2010) 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) - Add IGUIElement::bringToBack (patch written by DtD, although I'm to blame for the function-name)
- BurningVideo - BurningVideo
......
...@@ -38,6 +38,7 @@ namespace irr ...@@ -38,6 +38,7 @@ namespace irr
WindowId(0), WindowId(0),
LoggingLevel(ELL_INFORMATION), LoggingLevel(ELL_INFORMATION),
DisplayAdapter(0), DisplayAdapter(0),
UsePerformanceTimer(true),
SDK_version_do_not_use(IRRLICHT_SDK_VERSION) SDK_version_do_not_use(IRRLICHT_SDK_VERSION)
{ {
} }
...@@ -66,6 +67,7 @@ namespace irr ...@@ -66,6 +67,7 @@ namespace irr
WindowId = other.WindowId; WindowId = other.WindowId;
LoggingLevel = other.LoggingLevel; LoggingLevel = other.LoggingLevel;
DisplayAdapter = other.DisplayAdapter; DisplayAdapter = other.DisplayAdapter;
UsePerformanceTimer = other.UsePerformanceTimer;
return *this; return *this;
} }
...@@ -245,6 +247,13 @@ namespace irr ...@@ -245,6 +247,13 @@ namespace irr
/** So far only supported on D3D */ /** So far only supported on D3D */
u32 DisplayAdapter; 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. //! Don't use or change this parameter.
/** Always set it to IRRLICHT_SDK_VERSION, which is done by default. /** Always set it to IRRLICHT_SDK_VERSION, which is done by default.
This is needed for sdk version checks. */ This is needed for sdk version checks. */
......
...@@ -22,7 +22,7 @@ CIrrDeviceStub::CIrrDeviceStub(const SIrrlichtCreationParameters& params) ...@@ -22,7 +22,7 @@ CIrrDeviceStub::CIrrDeviceStub(const SIrrlichtCreationParameters& params)
FileSystem(0), InputReceivingSceneManager(0), CreationParams(params), FileSystem(0), InputReceivingSceneManager(0), CreationParams(params),
Close(false) Close(false)
{ {
Timer = new CTimer(); Timer = new CTimer(params.UsePerformanceTimer);
if (os::Printer::Logger) if (os::Printer::Logger)
{ {
os::Printer::Logger->grab(); os::Printer::Logger->grab();
......
...@@ -15,9 +15,9 @@ namespace irr ...@@ -15,9 +15,9 @@ namespace irr
{ {
public: public:
CTimer() CTimer(bool usePerformanceTimer=true)
{ {
os::Timer::initTimer(); os::Timer::initTimer(usePerformanceTimer);
} }
//! Returns current real time in milliseconds of the system. //! Returns current real time in milliseconds of the system.
......
...@@ -81,7 +81,7 @@ namespace os ...@@ -81,7 +81,7 @@ namespace os
static BOOL HighPerformanceTimerSupport = FALSE; static BOOL HighPerformanceTimerSupport = FALSE;
static BOOL MultiCore = FALSE; static BOOL MultiCore = FALSE;
void Timer::initTimer() void Timer::initTimer(bool usePerformanceTimer)
{ {
#if !defined(_WIN32_WCE) && !defined (_IRR_XBOX_PLATFORM_) #if !defined(_WIN32_WCE) && !defined (_IRR_XBOX_PLATFORM_)
// disable hires timer on multiple core systems, bios bugs result in bad hires timers. // disable hires timer on multiple core systems, bios bugs result in bad hires timers.
...@@ -89,7 +89,10 @@ namespace os ...@@ -89,7 +89,10 @@ namespace os
GetSystemInfo(&sysinfo); GetSystemInfo(&sysinfo);
MultiCore = (sysinfo.dwNumberOfProcessors > 1); MultiCore = (sysinfo.dwNumberOfProcessors > 1);
#endif #endif
if (usePerformanceTimer)
HighPerformanceTimerSupport = QueryPerformanceFrequency(&HighPerformanceFreq); HighPerformanceTimerSupport = QueryPerformanceFrequency(&HighPerformanceFreq);
else
HighPerformanceTimerSupport = FALSE;
initVirtualTimer(); initVirtualTimer();
} }
......
...@@ -72,7 +72,7 @@ namespace os ...@@ -72,7 +72,7 @@ namespace os
static ITimer::RealTimeDate getRealTimeAndDate(); static ITimer::RealTimeDate getRealTimeAndDate();
//! initializes the real timer //! initializes the real timer
static void initTimer(); static void initTimer(bool usePerformanceTimer=true);
//! sets the current virtual (game) time //! sets the current virtual (game) time
static void setTime(u32 time); static void setTime(u32 time);
......
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