diff options
Diffstat (limited to 'LibOVR/Src/Kernel')
-rw-r--r-- | LibOVR/Src/Kernel/OVR_System.cpp | 38 | ||||
-rw-r--r-- | LibOVR/Src/Kernel/OVR_System.h | 2 |
2 files changed, 21 insertions, 19 deletions
diff --git a/LibOVR/Src/Kernel/OVR_System.cpp b/LibOVR/Src/Kernel/OVR_System.cpp index 8d5d201..8fb93b5 100644 --- a/LibOVR/Src/Kernel/OVR_System.cpp +++ b/LibOVR/Src/Kernel/OVR_System.cpp @@ -35,6 +35,7 @@ limitations under the License. namespace OVR { +extern bool anyRiftsInExtendedMode(); // Stack of destroy listeners (push/pop semantics) static SystemSingletonInternal *SystemShutdownListenerStack = 0; @@ -49,17 +50,12 @@ void SystemSingletonInternal::PushDestroyCallbacks() SystemShutdownListenerStack = this; } - -// Initializes System core, installing allocator. -void System::Init(Log* log, Allocator *palloc) +void System::DirectDisplayInitialize() { - if (!Allocator::GetInstance()) - { - Log::SetGlobalLog(log); - Timer::initializeTimerSystem(); - Allocator::setInstance(palloc); - Display::Initialize(); #ifdef OVR_OS_WIN32 + // Set up display code for Windows + Win32::DisplayShim::GetInstance(); + // This code will look for the first display. If it's a display // that's extending the destkop, the code will assume we're in // compatibility mode. Compatibility mode prevents shim loading @@ -68,19 +64,23 @@ void System::Init(Log* log, Allocator *palloc) // we load the shim so we can render to it. // If no display is available, we revert to whatever the // driver tells us we're in - Ptr<DisplaySearchHandle> searchHandle = *Display::GetDisplaySearchHandle(); - Ptr<Display> pDisplay = NULL; - if (Display::GetDisplayCount(searchHandle) > 0) - { - pDisplay = Display::GetDisplay(0, searchHandle); + bool anyExtendedRifts = anyRiftsInExtendedMode() || Display::InCompatibilityMode( false ); + + Win32::DisplayShim::GetInstance().Initialize(anyExtendedRifts); +#endif } - if( pDisplay == NULL ) - Win32::DisplayShim::GetInstance().Initialize(Display::InCompatibilityMode()); - else - Win32::DisplayShim::GetInstance().Initialize(!pDisplay->ApplicationExclusive); -#endif +// Initializes System core, installing allocator. +void System::Init(Log* log, Allocator *palloc) +{ + if (!Allocator::GetInstance()) + { + Log::SetGlobalLog(log); + Timer::initializeTimerSystem(); + Allocator::setInstance(palloc); + Display::Initialize(); + DirectDisplayInitialize(); } else { diff --git a/LibOVR/Src/Kernel/OVR_System.h b/LibOVR/Src/Kernel/OVR_System.h index a85cd49..3bc2254 100644 --- a/LibOVR/Src/Kernel/OVR_System.h +++ b/LibOVR/Src/Kernel/OVR_System.h @@ -151,6 +151,8 @@ public: Destroy(); } + static void OVR_CDECL DirectDisplayInitialize(); + // Returns 'true' if system was properly initialized. static bool OVR_CDECL IsInitialized(); |