Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Vrally's avatar
Vrally
Protege
11 years ago

TimeWarp not working when running with emulated device

Hi,

I have some issues with the TimeWarp shader when running with the emulated device, i.e. ovrHmd_CreateDebug(ovrHmd_DK1)

If I run with the time warp shader I get the following look:

If I run with ovrHmd_DK2 as a emulated device I get the same incorrect behavior (but in higher resolution).

If I connect my device (a DK1 in this case) I get the correct look:

Running emulated without TimeWarp also works fine.

I don't know if this is related but if I try running in debug mode with emulated device, I am running into the following ASSERT in the FrameTimeManager::BeginFrame(unsigned frameIndex) function:
OVR_ASSERT(FrameTiming.Inputs.ScreenDelay != 0);

3 Replies

  • "pixelminer" wrote:
    I don't know if this is related but if I try running in debug mode with emulated device, I am running into the following ASSERT in the FrameTimeManager::BeginFrame(unsigned frameIndex) function:
    OVR_ASSERT(FrameTiming.Inputs.ScreenDelay != 0);



    You have to call the ovrHmd_ResetFrameTiming method at least once before you call ovrHmd_BeginFrameTiming method.
  • This does not solve the problems with the TimeWarp shader when using an emulated device (It still looks like the above pictures).

    But it do solve the ASSERT problem. A problem I would say comes from a inconsistency in the SDK. Calling ovrHmd_Create() will automatically call ovrHmd_ResetFrameTiming() from inside that function (if we have a valid device connected). But ovrHmd_ResetFrameTiming() is oddly enough not called from inside ovrHmd_CreateDebug().

    A bit inconsistent but easy to fix:


    // Get first available HMD
    hmd = ovrHmd_Create(0);

    // If no HMD is found try an emulated device
    if (!hmd) {
    std::cout << "Warning: No device could be found. Creating emulated device " << std::endl;
    hmd = ovrHmd_CreateDebug(ovrHmd_DK1);
    ovrHmd_ResetFrameTiming(hmd, 0);
    }
  • I finally figured out why I was getting bogus matrixes as response from when running an emulated device:
    ovrHmd_GetEyeTimewarpMatrices(ovrHmd hmddesc, ovrEyeType eye, ovrPosef renderPose, ovrMatrix4f twmOut[2])


    The reason was that I was not initializing the renderPose struct correctly, so the ovrPosef struct was containing uninitialized variables.

    When running with a real device connected this struct was populated with data from the ovrHmd_GetEyePose() function. But I had that function inside conditional that never happened when running an emulated device:
    ovrPoseStatef headpose = ts.HeadPose;
    if (ts.StatusFlags & (ovrStatus_OrientationTracked | ovrStatus_PositionTracked)) {
    ...
    for (int eyeIndex = 0; eyeIndex < ovrEye_Count; ++eyeIndex) {
    ovrEyeType eye = m_hmdDevice->EyeRenderOrder[eyeIndex];
    m_headPose[eye] = ovrHmd_GetEyePose(m_hmdDevice, eye);
    }
    }


    Removing this conditional statement solved my issue.