本文整理汇总了C++中OVR_DEBUG_LOG函数的典型用法代码示例。如果您正苦于以下问题:C++ OVR_DEBUG_LOG函数的具体用法?C++ OVR_DEBUG_LOG怎么用?C++ OVR_DEBUG_LOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OVR_DEBUG_LOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OVR_DEBUG_LOG
HMDState* HMDState::CreateHMDState(NetClient* client, const HMDNetworkInfo& netInfo)
{
// HMDState works through a handle to service HMD....
HMDInfo hinfo;
if (!client->Hmd_GetHmdInfo(netInfo.NetId, &hinfo))
{
OVR_DEBUG_LOG(("[HMDState] Unable to get HMD info"));
return nullptr;
}
#if !defined(HEADLESS_APP)
#ifdef OVR_OS_WIN32
OVR_DEBUG_LOG(("[HMDState] Setting up display shim"));
// Initialize the display shim before reporting the display to the user code
// so that this will happen before the D3D display object is created.
Win32::DisplayShim::GetInstance().Update(&hinfo.ShimInfo);
#endif
#endif /* !defined(HEADLESS_APP) */
Ptr<Profile> pDefaultProfile = *ProfileManager::GetInstance()->GetDefaultUserProfile(&hinfo);
OVR_DEBUG_LOG(("[HMDState] Using profile %s", pDefaultProfile->GetValue(OVR_KEY_USER)));
HMDState* hmds = new HMDState(hinfo, pDefaultProfile, &netInfo, client);
if (!hmds->InitializeSharedState())
{
delete hmds;
return nullptr;
}
return hmds;
}
示例2: OVR_DEBUG_LOG
HMDState* HMDState::CreateHMDState(NetClient* client, const HMDNetworkInfo& netInfo)
{
// HMDState works through a handle to service HMD....
HMDInfo hinfo;
if (!client->Hmd_GetHmdInfo(netInfo.NetId, &hinfo))
{
OVR_DEBUG_LOG(("[HMDState] Unable to get HMD info"));
return NULL;
}
#ifdef OVR_OS_WIN32
OVR_DEBUG_LOG(("Setting up display shim"));
// Initialize the display shim before reporting the display to the user code
// so that this will happen before the D3D display object is created.
Win32::DisplayShim::GetInstance().Update(&hinfo.ShimInfo);
#endif
Ptr<Profile> pDefaultProfile = *ProfileManager::GetInstance()->GetDefaultUserProfile(&hinfo);
OVR_DEBUG_LOG(("Using profile %s", pDefaultProfile->GetValue(OVR_KEY_USER)));
HMDState* hmds = new HMDState(netInfo, hinfo, pDefaultProfile, client);
if (!hmds->SharedStateReader.Open(netInfo.SharedMemoryName.ToCStr()))
{
delete hmds;
return NULL;
}
hmds->TheSensorStateReader.SetUpdater(hmds->SharedStateReader.Get());
hmds->TheLatencyTestStateReader.SetUpdater(hmds->SharedStateReader.Get());
return hmds;
}
示例3: STR1
void OculusWorldDemoApp::InitMainFilePath()
{
// We try alternative relative locations for the file.
const String contentBase = pPlatform->GetContentDirectory() + "/" + WORLDDEMO_ASSET_PATH;
const char* baseDirectories[] = { "",
contentBase.ToCStr(),
#ifdef SHRDIR
#define STR1(x) #x
#define STR(x) STR1(x)
STR(SHRDIR) "/OculusWorldDemo/Assets/Tuscany/"
#endif
};
String newPath;
for(size_t i = 0; i < OVR_ARRAY_COUNT(baseDirectories); ++i)
{
newPath = baseDirectories[i];
newPath += WORLDDEMO_ASSET_FILE;
OVR_DEBUG_LOG(("Trying to load the scene at: %s...", newPath.ToCStr()));
if (SysFile(newPath).IsValid())
{
OVR_DEBUG_LOG(("Success loading %s", newPath.ToCStr()));
MainFilePath = newPath;
return;
}
}
OVR_DEBUG_LOG(("Unable to find any version of %s. Do you have your working directory set right?", WORLDDEMO_ASSET_FILE));
}
示例4: defined
void PerformanceTimer::Initialize()
{
#if defined(OVR_OS_WIN32) // Desktop Windows only
// The following has the effect of setting the NT timer resolution (NtSetTimerResolution) to 1 millisecond.
MMRESULT mmr = timeBeginPeriod(1);
OVR_ASSERT(TIMERR_NOERROR == mmr);
OVR_UNUSED(mmr);
#endif
InitializeCriticalSection(&TimeCS);
MMTimeWrapCounter = 0;
getFrequency();
#if defined(OVR_OS_WIN32) // Desktop Windows only
// Set Vista flag. On Vista, we can just use QPC() without all the extra work
OSVERSIONINFOEX ver;
ZeroMemory(&ver, sizeof(OSVERSIONINFOEX));
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
ver.dwMajorVersion = 6; // Vista+
DWORDLONG condMask = 0;
VER_SET_CONDITION(condMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
// VerifyVersionInfo returns true if the OS meets the conditions set above
UsingVistaOrLater = VerifyVersionInfo(&ver, VER_MAJORVERSION, condMask) != 0;
#else
UsingVistaOrLater = true;
#endif
OVR_DEBUG_LOG(("PerformanceTimer UsingVistaOrLater = %d", (int)UsingVistaOrLater));
#if defined(OVR_BUILD_DEBUG) && defined(OVR_OS_WIN32)
HMODULE hNtDll = LoadLibrary(L"NtDll.dll");
if (hNtDll)
{
pNtQueryTimerResolution = (NtQueryTimerResolutionType)GetProcAddress(hNtDll, "NtQueryTimerResolution");
//pNtSetTimerResolution = (NtSetTimerResolutionType)GetProcAddress(hNtDll, "NtSetTimerResolution");
if(pNtQueryTimerResolution)
{
ULONG MinimumResolution; // in 100-ns units
ULONG MaximumResolution;
ULONG ActualResolution;
pNtQueryTimerResolution(&MinimumResolution, &MaximumResolution, &ActualResolution);
OVR_DEBUG_LOG(("NtQueryTimerResolution = Min %ld us, Max %ld us, Current %ld us", MinimumResolution / 10, MaximumResolution / 10, ActualResolution / 10));
}
FreeLibrary(hNtDll);
}
#endif
}
示例5: hid_get_feature_report
//-----------------------------------------------------------------------------
bool HIDDevice::GetFeatureReport(UByte* data, UInt32 length)
{
if (DeviceHandle < 0)
return false;
int skipped_report_id = 0;
int report_number = data[0];
if (report_number == 0x0) {
/* Offset the return buffer by 1, so that the report ID
will remain in byte 0. */
data++;
length--;
skipped_report_id = 1;
}
int r = hid_get_feature_report(DeviceHandle, data, length);
// int r = ioctl(DeviceHandle, HIDIOCGFEATURE(length), data);
if(r < 0)
{
OVR_DEBUG_LOG(("Error in LibOVR GetFeatureReport: %s",strerror(errno)));
}
return (r >= 0);
}
示例6: Reset
bool SensorFusion::AttachToSensor(SensorDevice* sensor)
{
if (sensor != NULL)
{
MessageHandler* pCurrentHandler = sensor->GetMessageHandler();
if (pCurrentHandler == &Handler)
{
Reset();
return true;
}
if (pCurrentHandler != NULL)
{
OVR_DEBUG_LOG(
("SensorFusion::AttachToSensor failed - sensor %p already has handler", sensor));
return false;
}
}
if (Handler.IsHandlerInstalled())
{
Handler.RemoveHandlerFromDevices();
}
if (sensor != NULL)
{
sensor->SetMessageHandler(&Handler);
}
Reset();
return true;
}
示例7: OVR_DEBUG_LOG
bool LatencyTest::SetDevice(LatencyTestDevice* device)
{
if (device != Device)
{
if (device != NULL)
{
if (device->GetMessageHandler() != NULL)
{
OVR_DEBUG_LOG(
("LatencyTest::AttachToDevice failed - device %p already has handler", device));
return false;
}
}
if (Device != NULL)
{
Device->SetMessageHandler(0);
}
Device = device;
if (Device != NULL)
{
Device->SetMessageHandler(&Handler);
// Set trigger threshold.
LatencyTestConfiguration configuration(SENSOR_DETECT_THRESHOLD, false); // No samples streaming.
Device->SetConfiguration(configuration, true);
}
}
return true;
}
示例8: OVR_DEBUG_LOG
bool Thread::Start(ThreadState initialState)
{
if (initialState == NotRunning)
return 0;
if (GetThreadState() != NotRunning)
{
OVR_DEBUG_LOG(("Thread::Start failed - thread %p already running", this));
return 0;
}
// Free old thread handle before creating the new one
CleanupSystemThread();
ExitCode = NULL;
ThreadFlags = (initialState == Running) ? OVR_THREAD_STARTED : OVR_THREAD_START_SUSPENDED;
ThreadHandle = (HANDLE) _beginthreadex(0, (unsigned)StackSize,
Thread_Win32StartFn, this, 0, (unsigned*)&IdValue);
// Failed? Fail the function
if (ThreadHandle == 0)
{
ThreadFlags = 0;
return 0;
}
return 1;
}
示例9: defined
// Initializes System core, installing allocator.
void System::Init()
{
#if defined(_MSC_VER)
// Make it so that failure of the C malloc family of functions results in the same behavior as C++ operator new failure.
// This allows us to throw exceptions for malloc usage the same as for operator new bad_alloc.
_set_new_mode(1);
// Tells the standard library to direct new (and malloc) failures to us. Normally we wouldn't need to do this, as the
// C++ Standard Library already throws std::bad_alloc on operator new failure. The problem is that the Standard Library doesn't
// throw std::bad_alloc upon malloc failure, and we can only intercept malloc failure via this means. _set_new_handler specifies
// a global handler for the current running Standard Library. If the Standard Library is being dynamically linked instead
// of statically linked, then this is a problem because a call to _set_new_handler would override anything the application
// has already set.
_set_new_handler(OVRNewFailureHandler);
#else
// This allows us to throw OVR::bad_alloc instead of std::bad_alloc, which provides less information.
// Question: Does this set the handler for all threads or just the current thread? The C++ Standard doesn't
// explicitly state this, though it may be implied from other parts of the Standard.
std::set_new_handler(OVRNewFailureHandler);
#endif
if (++System_Init_Count == 1)
{
Timer::initializeTimerSystem();
}
else
{
OVR_DEBUG_LOG(("[System] Init recursively called; depth = %d", System_Init_Count));
}
}
示例10: memset
bool HIDDevice::openDevice()
{
memset(&ReadOverlapped, 0, sizeof(OVERLAPPED));
Device = HIDManager->CreateHIDFile(DevDesc.Path.ToCStr());
if (Device == INVALID_HANDLE_VALUE)
{
OVR_DEBUG_LOG(("Failed 'CreateHIDFile' while opening device, error = 0x%X.",
::GetLastError()));
Device = 0;
return false;
}
if (!HIDManager->HidD_SetNumInputBuffers(Device, 128))
{
OVR_ASSERT_LOG(false, ("Failed 'HidD_SetNumInputBuffers' while initializing device."));
::CloseHandle(Device);
Device = 0;
return false;
}
// Create a manual-reset non-signaled event.
ReadOverlapped.hEvent = ::CreateEvent(0, TRUE, FALSE, 0);
if (!ReadOverlapped.hEvent)
{
OVR_ASSERT_LOG(false, ("Failed to create event."));
::CloseHandle(Device);
Device = 0;
return false;
}
if (!initInfo())
{
OVR_ASSERT_LOG(false, ("Failed to get HIDDevice info."));
::CloseHandle(ReadOverlapped.hEvent);
memset(&ReadOverlapped, 0, sizeof(OVERLAPPED));
::CloseHandle(Device);
Device = 0;
return false;
}
if (!initializeRead())
{
OVR_ASSERT_LOG(false, ("Failed to get intialize read for HIDDevice."));
::CloseHandle(ReadOverlapped.hEvent);
memset(&ReadOverlapped, 0, sizeof(OVERLAPPED));
::CloseHandle(Device);
Device = 0;
return false;
}
return true;
}
示例11: SetThreadName
int DeviceManagerThread::Run()
{
ThreadCommand::PopBuffer command;
SetThreadName("OVR::DeviceManagerThread");
LogText("OVR::DeviceManagerThread - running (ThreadId=%p).\n", GetThreadId());
while(!IsExiting())
{
// PopCommand will reset event on empty queue.
if (PopCommand(&command))
{
command.Execute();
}
else
{
bool commands = 0;
do
{
int n = poll(&PollFds[0], PollFds.GetSize(), -1);
for (int i = 0; i < PollFds.GetSize(); i++)
{
if (PollFds[i].revents & POLLERR)
{
OVR_DEBUG_LOG(("poll: error on [%d]: %d", i, PollFds[i].fd));
}
else if (PollFds[i].revents & POLLIN)
{
if (FdNotifiers[i])
FdNotifiers[i]->OnEvent(i, PollFds[i].fd);
else if (i == 0) // command
{
char dummy[128];
read(PollFds[i].fd, dummy, 128);
commands = 1;
}
}
if (PollFds[i].revents & POLLHUP)
PollFds[i].events = 0;
if (PollFds[i].revents != 0)
{
n--;
if (n == 0)
break;
}
}
} while (PollFds.GetSize() > 0 && !commands);
}
}
LogText("OVR::DeviceManagerThread - exiting (ThreadId=%p).\n", GetThreadId());
return 0;
}
示例12: defined
bool HSWDisplay::Initialize(const ovrRenderAPIConfig* apiConfig)
{
const ovrGLConfig* config = (const ovrGLConfig*)apiConfig;
if(config)
{
// The following is essentially copied from CAPI_GL_DistortionRender.cpp's
// Initialize function. To do: Merge this to a central location.
RenderParams.Multisample = config->OGL.Header.Multisample;
RenderParams.RTSize = config->OGL.Header.RTSize;
#if defined(OVR_OS_WIN32)
RenderParams.Window = (config->OGL.Window) ? config->OGL.Window : GetActiveWindow();
RenderParams.DC = config->OGL.DC;
#elif defined(OVR_OS_LINUX)
if (config->OGL.Disp)
RenderParams.Disp = config->OGL.Disp;
if (!RenderParams.Disp)
RenderParams.Disp = XOpenDisplay(NULL);
if (!RenderParams.Disp)
{
OVR_DEBUG_LOG(("XOpenDisplay failed."));
return false;
}
if (config->OGL.Win)
RenderParams.Win= config->OGL.Win;
if (!RenderParams.Win)
RenderParams.Win = glXGetCurrentDrawable();
if (!RenderParams.Win)
{
OVR_DEBUG_LOG(("XGetInputFocus failed."));
return false;
}
#endif
}
else
{
UnloadGraphics();
}
return true;
}
示例13: OVR_DEBUG_LOG
void RefCountNTSImplCore::checkInvalidDelete(RefCountNTSImplCore *pmem)
{
#ifdef OVR_BUILD_DEBUG
if (pmem->RefCount != 0)
{
OVR_DEBUG_LOG( ("Invalid delete call on ref-counted object at %p. Please use Release()", pmem) );
OVR_ASSERT(0);
}
#else
OVR_UNUSED( pmem );
#endif
}
示例14: OVR_DEBUG_LOG
// Initializes System core, installing allocator.
void System::Init(Log* log, Allocator *palloc)
{
if (!Allocator::GetInstance())
{
Log::SetGlobalLog(log);
Allocator::setInstance(palloc);
}
else
{
OVR_DEBUG_LOG(("[System] Init failed - duplicate call."));
}
}
示例15: clock_gettime
UInt64 Timer::GetTicksNanos()
{
// Choreographer vsync timestamp is based on.
struct timespec tp;
const int status = clock_gettime(CLOCK_MONOTONIC, &tp);
if (status != 0)
{
OVR_DEBUG_LOG(("clock_gettime status=%i", status ));
}
const UInt64 result = (UInt64)tp.tv_sec * (UInt64)(1000 * 1000 * 1000) + UInt64(tp.tv_nsec);
return result;
}