Forum Discussion
ScottieBizzle
12 years agoExplorer
Swapchain presenting to window, yet no blue light
My display mode is set to "Direct HMD Access from Apps" and the OculusRoomTiny sample works fine. It initializes, then on the 3rd or so call to ProcessAndRender ( specifically the RParams.pSwapChain->Present(swapInterval, 0) call ) the device kicks in, the blue light goes on and whatever is on the swap chain is shown on the HMD.
Now in my own app, I've got everything set up almost the same, everything is rendering fine, and the final image is warped to my swap chain and displayed in my window, but the device never kicks in, light stays yellow and nothing is sent to the HMD.
So in the tiny sample, what exactly prompts the device to know the swap chain is setup for the HMD? I was assuming it was the ovrHmd_AttachToWindow(HMD, window, NULL, NULL), call and the fact the swap chain is also set to that window.
Here's my window creation code...
WNDCLASS wc;
memset(&wc, 0, sizeof(wc));
wc.lpszClassName = "OVRAppWindow";
wc.style = CS_OWNDC;
wc.lpfnWndProc = ::DefWindowProc;
wc.cbWndExtra = NULL;
RegisterClass( &wc );
HWND HWindow = CreateWindow( "OVRAppWindow", "OculusRoomTiny", WS_POPUP | WS_VISIBLE | WS_OVERLAPPEDWINDOW, 0, 0, m_OculusHMD->Resolution.w, m_OculusHMD->Resolution.h, NULL, NULL, ::AfxGetApp()->m_hInstance, NULL );
m_Oculus_Window.Attach( HWindow );
ovrHmd_AttachToWindow( m_OculusHMD, HWindow, NULL, NULL );
I'm also calling the ovrHmd_BeginFrame(HMD, 0) and ovrHmd_EndFrame(HMD, eyeRenderPose, &EyeTexture[0].Texture) and the image is being presented to my window fine.
Any idea what I'm missing here?
Thanks
Now in my own app, I've got everything set up almost the same, everything is rendering fine, and the final image is warped to my swap chain and displayed in my window, but the device never kicks in, light stays yellow and nothing is sent to the HMD.
So in the tiny sample, what exactly prompts the device to know the swap chain is setup for the HMD? I was assuming it was the ovrHmd_AttachToWindow(HMD, window, NULL, NULL), call and the fact the swap chain is also set to that window.
Here's my window creation code...
WNDCLASS wc;
memset(&wc, 0, sizeof(wc));
wc.lpszClassName = "OVRAppWindow";
wc.style = CS_OWNDC;
wc.lpfnWndProc = ::DefWindowProc;
wc.cbWndExtra = NULL;
RegisterClass( &wc );
HWND HWindow = CreateWindow( "OVRAppWindow", "OculusRoomTiny", WS_POPUP | WS_VISIBLE | WS_OVERLAPPEDWINDOW, 0, 0, m_OculusHMD->Resolution.w, m_OculusHMD->Resolution.h, NULL, NULL, ::AfxGetApp()->m_hInstance, NULL );
m_Oculus_Window.Attach( HWindow );
ovrHmd_AttachToWindow( m_OculusHMD, HWindow, NULL, NULL );
I'm also calling the ovrHmd_BeginFrame(HMD, 0) and ovrHmd_EndFrame(HMD, eyeRenderPose, &EyeTexture[0].Texture) and the image is being presented to my window fine.
Any idea what I'm missing here?
Thanks
17 Replies
"ScottieBizzle" wrote:
So in the tiny sample, what exactly prompts the device to know the swap chain is setup for the HMD? I was assuming it was the ovrHmd_AttachToWindow(HMD, window, NULL, NULL), call and the fact the swap chain is also set to that window.
AttachToWindow doesn't actually do the attaching itself. It sends a network packet (RPC call) to the ovr service which will then do the actual work.
Sadly, the service is closed source, so we can't debug what it's doing.
I'm in a similar situation, trying to get client rendering working in direct rift mode (in Ogre3D), but all I can get is one of two outcomes:
- nothing happens, app runs like normal on the monitor (when rift init is after directx9)
- IDirect3D9::CheckDeviceMultiSampleType fails with an error saying 3d in not available (when rift init is before directx9)
Looking at the vs debug info, it seems in the second case the IDirect3D9 device has been hijacked by OVRDisplayRT64.dll.
Shame we can't debug that since it's all closed source too.- ScottieBizzleExplorerI'm on DX11, 11.2 sdk, some things that may be different in my setup compared to the sample are..
using wc.lpfnWndProc = ::DefWindowProc; // wasn't sure what proc to use, then again, I wouldn't expect anything to display in the window if this was wrong
I was using a IDXGISwapChain1 instead of the IDXGISwapChain used in the sample ( suggested by MS going forward ), but I changed it to IDXGISwapChain and that didn't fix anything.
I've got two 27" cinema displays, and my dummy window's being created on the same display as the tiny sample is running so figured where it was created might matter.
Does the device creation matter at all, or is the HMD super picky about how the swapChain is created or something?
hopefully the oculus team can point us to what could be wrong or how to debug it ourselves since everything seems fine. - I've got mine working, but I did it by dropping DX9 and going to DX11. I think the ovr display shim for dx9 is faulty.
Something to be careful of, you must call ovr_Initialize() before you create the direct3d device. If it is called after, then you have a regular direct3d device instead of a hijacked device with direct mode support. - ScottieBizzleExplorerI was hoping you would be right about the order in which things are called so I reworked my code to match the sample which has this order...
ovr_Initialize();
HMD = ovrHmd_Create(0);
CreateWindow
CreateDXGIFactory
D3D11CreateDevice ( with or without specifying Adapter seems to work )
Create the swap chain and target view
ovrHmd_AttachToWindow
create the oversized target ( should not matter )
ovrHmd_ConfigureRendering
ovrHmd_SetEnabledCaps
ovrHmd_ConfigureTracking
then let er rip...
Still does not work for me. I've tried D3D_FEATURE_LEVEL_11_0 and D3D_FEATURE_LEVEL_11_1 when creating the device even downgraded my IDXGIFactory from IDXGIFactory2 and use the older CreateSwapChain over CreateSwapChainForHwnd. Still nothing.
Anything else I may be missing? - AnonymousHonored GuestYou may have difficulty output to the Rift in general. Have you see Direct to Rift work in any other apps? If you have DisplayLink installed or are using a laptop for development your configuration is not presently supported with Direct to Rift.
- ScottieBizzleExplorerAs mentioned above, the Tiny sample in the SDK works fine, and my code is set up almost identical, but as my user interface is also ussing DirectX 11, there's lots of other stuff happening before and after the beginframe/endframe calls. The motion tracking seems to be working, just the HMD no kicking in...
Dying to get this running. - ScottieBizzleExplorerNot sure if this is a clue, but the health and safety warning doesn't go away on it's own and I can't toggle it off. Still searching how to manually disable it.
- AnonymousHonored GuestMake sure the window you attach to matches the handle you gave to the swapchain.
- ScottieBizzleExplorerYa it's the same one.
Update 1: So I was able to at least get my software working with "Extend Desktop to the HMD" using windowed or fullscreen. Windowed gave me some jerkiness even with the simplest of scenes running at 300+ f/s. Making my swapchain fullscreen fixes this.
Update 2: Woke up and decided to see if there were any extra libs that I was not including which was making Direct to HMD fail silently, To my surprise, Direct to HMD now works, but it was not because I was missing any libs, maybe I needed a hard reset or something changed. Now the only problem is the jerkiness is worst. My swapchain is in windowed mode since I don't want that window taking over my monitor or anything. At least with "Extend Desktop to the HMD" I was able to go fullscreen without having to see the dummy window. - ScottieBizzleExplorerWith windowed swap buffer with Direct mode and now I get a very noticeable vertical tear almost center screen, where it looks like the right side is lagging, and this is for both eyes and only happens with double buffered.
But I think I'm good to go now with Direct to HMD in windowed mode ( I just push the window 5000 pixels vertically to hide it from the monitors ) with single buffer. Still not sure why it just started working all of a sudden. I probably fixed it when reordering my calls, but probably needed a reset or something else was screwy.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device