diff options
Diffstat (limited to 'LibOVR/Src/Kernel')
-rw-r--r-- | LibOVR/Src/Kernel/OVR_Log.cpp | 2 | ||||
-rw-r--r-- | LibOVR/Src/Kernel/OVR_System.cpp | 6 | ||||
-rw-r--r-- | LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp | 2 | ||||
-rw-r--r-- | LibOVR/Src/Kernel/OVR_Types.h | 26 |
4 files changed, 34 insertions, 2 deletions
diff --git a/LibOVR/Src/Kernel/OVR_Log.cpp b/LibOVR/Src/Kernel/OVR_Log.cpp index 2631879..34cc605 100644 --- a/LibOVR/Src/Kernel/OVR_Log.cpp +++ b/LibOVR/Src/Kernel/OVR_Log.cpp @@ -397,11 +397,13 @@ void SetAssertionHandler(OVRAssertionHandler assertionHandler, intptr_t userPara intptr_t DefaultAssertionHandler(intptr_t /*userParameter*/, const char* title, const char* message) { +#if !defined(HEADLESS_APP) if(OVRIsDebuggerPresent()) { OVR_DEBUG_BREAK; } else +#endif /* !defined(HEADLESS_APP) */ { #if defined(OVR_BUILD_DEBUG) // Print a stack trace of all threads. diff --git a/LibOVR/Src/Kernel/OVR_System.cpp b/LibOVR/Src/Kernel/OVR_System.cpp index 66c764a..c8c7b87 100644 --- a/LibOVR/Src/Kernel/OVR_System.cpp +++ b/LibOVR/Src/Kernel/OVR_System.cpp @@ -29,9 +29,11 @@ limitations under the License. #include "OVR_Threads.h" #include "OVR_Timer.h" #include "../Displays/OVR_Display.h" +#if !defined(HEADLESS_APP) #ifdef OVR_OS_WIN32 #include "../Displays/OVR_Win32_ShimFunctions.h" #endif +#endif /* !defined(HEADLESS_APP) */ namespace OVR { @@ -55,6 +57,7 @@ void SystemSingletonInternal::PushDestroyCallbacks() void System::DirectDisplayInitialize() { +#if !defined(HEADLESS_APP) #ifdef OVR_OS_WIN32 // Set up display code for Windows Win32::DisplayShim::GetInstance(); @@ -72,6 +75,7 @@ void System::DirectDisplayInitialize() DisplayShimInitialized = Win32::DisplayShim::GetInstance().Initialize(anyExtendedRifts); #endif +#endif /* !defined(HEADLESS_APP) */ } bool System::DirectDisplayEnabled() @@ -100,9 +104,11 @@ void System::Destroy() { if (Allocator::GetInstance()) { +#if !defined(HEADLESS_APP) #ifdef OVR_OS_WIN32 Win32::DisplayShim::GetInstance().Shutdown(); #endif +#endif /* !defined(HEADLESS_APP) */ // Invoke all of the post-finish callbacks (normal case) for (SystemSingletonInternal *listener = SystemShutdownListenerStack; listener; listener = listener->NextSingleton) diff --git a/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp b/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp index 4146dda..29ef845 100644 --- a/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp +++ b/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp @@ -1103,7 +1103,7 @@ void Thread::SetThreadName(const char* name, ThreadId threadId) void Thread::SetCurrentThreadName( const char* name )
{
- SetThreadName(name, (ThreadId)::GetCurrentThreadId());
+ SetThreadName(name, (ThreadId)(intptr_t)::GetCurrentThreadId()); // should be: typedef intptr_t ThreadId;
}
diff --git a/LibOVR/Src/Kernel/OVR_Types.h b/LibOVR/Src/Kernel/OVR_Types.h index d42d131..31bdd62 100644 --- a/LibOVR/Src/Kernel/OVR_Types.h +++ b/LibOVR/Src/Kernel/OVR_Types.h @@ -587,7 +587,7 @@ struct OVR_GUID #include <stdlib.h> #define OVR_ASSERT_M(p, message) do { if (!(p)) { OVR_DEBUG_BREAK; exit(0); } } while(0) #define OVR_ASSERT(p) do { if (!(p)) { OVR_DEBUG_BREAK; exit(0); } } while(0) - #else + #elif !defined(HEADLESS_APP) // void OVR_ASSERT_M(bool expression, const char message); // Note: The expresion below is expanded into all usage of this assertion macro. // We should try to minimize the size of the expanded code to the extent possible. @@ -611,6 +611,30 @@ struct OVR_GUID // void OVR_ASSERT(bool expression); #define OVR_ASSERT(p) OVR_ASSERT_M((p), (#p)) + #else + // void OVR_ASSERT_M(bool expression, const char message); + // Note: The expresion below is expanded into all usage of this assertion macro. + // We should try to minimize the size of the expanded code to the extent possible. + #define OVR_ASSERT_M(p, message) do \ + { \ + if (!(p)) \ + { \ + intptr_t ovrAssertUserParam; \ + OVRAssertionHandler ovrAssertUserHandler = OVR::GetAssertionHandler(&ovrAssertUserParam); \ + \ + if(ovrAssertUserHandler) \ + { \ + ovrAssertUserHandler(ovrAssertUserParam, "Assertion failure", message); \ + } \ + else \ + { \ + OVR_DEBUG_BREAK; \ + } \ + } \ + } while(0) + + // void OVR_ASSERT(bool expression); + #define OVR_ASSERT(p) OVR_ASSERT_M((p), (#p)) #endif // Acts the same as OVR_ASSERT in debug builds. Acts the same as OVR_UNUSED in release builds. |