From a352ecb7e63304034ac93332cf0c4d9183df867e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 14 Jul 2015 07:12:13 +0200 Subject: Fix compilation / linkage of 0.5.0.1 HEADLESS_APP mode Tested: GNU/Linux and OSX --- LibOVR/Src/CAPI/CAPI_HMDState.cpp | 13 ++++-- LibOVR/Src/OVR_CAPI.cpp | 17 ++++++-- LibOVRKernel/Src/Kernel/OVR_DebugHelp.cpp | 69 +++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 7 deletions(-) diff --git a/LibOVR/Src/CAPI/CAPI_HMDState.cpp b/LibOVR/Src/CAPI/CAPI_HMDState.cpp index 7a00bf8..fede019 100755 --- a/LibOVR/Src/CAPI/CAPI_HMDState.cpp +++ b/LibOVR/Src/CAPI/CAPI_HMDState.cpp @@ -146,6 +146,7 @@ HMDState::HMDState(HMDInfo const & hmdInfo, { pHSWDisplay = *OVR::CAPI::HSWDisplay::Factory(ovrRenderAPI_None, pHmdDesc, RenderState); } +#endif /* !defined(HEADLESS_APP) */ RenderIMUTimeSeconds = 0.; @@ -173,7 +174,6 @@ HMDState::~HMDState() OVR_FREE(pHmdDesc); pHmdDesc = nullptr; } -#endif /* !defined(HEADLESS_APP) */ } bool HMDState::InitializeSharedState() @@ -950,13 +950,18 @@ bool HMDState::ConfigureRendering(ovrEyeRenderDesc eyeRenderDescOut[2], if (!pRenderer) { +#if !defined(HEADLESS_APP) pRenderer = *DistortionRenderer::APICreateRegistry [apiConfig->Header.API](); +#endif /* !defined(HEADLESS_APP) */ } - if (!pRenderer || - !pRenderer->Initialize(apiConfig, &TheTrackingStateReader, - &TimewarpTimer, &RenderState)) + if (!pRenderer +#if !defined(HEADLESS_APP) + || !pRenderer->Initialize(apiConfig, &TheTrackingStateReader, + &TimewarpTimer, &RenderState) +#endif /* !defined(HEADLESS_APP) */ + ) { RenderingConfigured = false; return false; diff --git a/LibOVR/Src/OVR_CAPI.cpp b/LibOVR/Src/OVR_CAPI.cpp index c530f82..e02151a 100755 --- a/LibOVR/Src/OVR_CAPI.cpp +++ b/LibOVR/Src/OVR_CAPI.cpp @@ -695,7 +695,12 @@ OVR_PUBLIC_FUNCTION(void) ovrHmd_EndFrame(ovrHmd hmddesc, hmds->checkBeginFrameScope("ovrHmd_EndFrame"); ThreadChecker::Scope checkScope(&hmds->RenderAPIThreadChecker, "ovrHmd_EndFrame"); - hmds->pRenderer->SetLatencyTestColor(hmds->LatencyTestActive ? hmds->LatencyTestDrawColor : nullptr); +#if !defined(HEADLESS_APP) + if (hmds->pRenderer) + { + hmds->pRenderer->SetLatencyTestColor(hmds->LatencyTestActive ? hmds->LatencyTestDrawColor : nullptr); + } +#endif /* !defined(HEADLESS_APP) */ ovrHmd_GetLatencyTest2DrawColor(hmddesc, nullptr); // We don't actually need to draw color, so send nullptr @@ -1111,13 +1116,19 @@ OVR_PUBLIC_FUNCTION(ovrBool) ovrHmd_GetLatencyTest2DrawColor(ovrHmd hmddesc, uns rgbColorOut[2] = hmds->LatencyTest2DrawColor[2]; } - if (hmds->pRenderer) +#if !defined(HEADLESS_APP) + if (hmds->pRenderer) { hmds->pRenderer->SetLatencyTest2Color(hmds->LatencyTest2DrawColor); + } +#endif /* !defined(HEADLESS_APP) */ } else { - if (hmds->pRenderer) +#if !defined(HEADLESS_APP) + if (hmds->pRenderer) { hmds->pRenderer->SetLatencyTest2Color(nullptr); + } +#endif /* !defined(HEADLESS_APP) */ } return dk2LatencyTest ? ovrTrue : ovrFalse; diff --git a/LibOVRKernel/Src/Kernel/OVR_DebugHelp.cpp b/LibOVRKernel/Src/Kernel/OVR_DebugHelp.cpp index ea39fb0..34fdd5f 100644 --- a/LibOVRKernel/Src/Kernel/OVR_DebugHelp.cpp +++ b/LibOVRKernel/Src/Kernel/OVR_DebugHelp.cpp @@ -21,6 +21,9 @@ limitations under the License. ************************************************************************************/ #include "OVR_DebugHelp.h" + +#if !defined(HEADLESS_APP) + #include "OVR_Types.h" #include "OVR_UTF8Util.h" #include "OVR_Atomic.h" @@ -4099,3 +4102,69 @@ int GUIExceptionListener::HandleException(uintptr_t userValue, OVR_RESTORE_MSVC_WARNING() + +#else /* !defined(HEADLESS_APP) */ + +namespace OVR { + // Exits the process with the given exit code. + void ExitProcess(intptr_t processReturnValue) + { + exit((int)processReturnValue); + } + bool OVRIsDebuggerPresent() + { + return false; + } + void ExceptionHandler::ReportDeadlock(const char* threadName, + const char* organizationName, + const char* applicationName) + { + } + + + bool SymbolLookup::Initialize() + { + return true; + } + + bool SymbolLookup::IsInitialized() + { + return true; + } + + void SymbolLookup::Shutdown() + { + } + + bool SymbolLookup::Refresh() + { + return true; + } + + size_t SymbolLookup::GetBacktrace(void* addressArray[], size_t addressArrayCapacity, size_t skipCount, void* platformThreadContext, OVR::ThreadSysId threadSysIdHelp) + { + return 0; + } + bool SymbolLookup::LookupSymbol(uint64_t address, SymbolInfo& symbolInfo) + { + return false; + } + bool SymbolLookup::LookupSymbols(uint64_t* addressArray, SymbolInfo* pSymbolInfoArray, size_t arraySize) + { + return false; + } + SymbolLookup::SymbolLookup() { } + SymbolLookup::~SymbolLookup() { } + bool SymbolLookup::ReportThreadCallstacks(OVR::String& sOutput, size_t skipCount) + { + sOutput.Clear(); + return true; + } + bool SymbolLookup::ReportModuleInformation(OVR::String& sOutput) + { + sOutput.Clear(); + return true; + } +} // namespace OVR + +#endif /* !defined(HEADLESS_APP) */ -- cgit v1.2.3