I'm trying to add a quad layer to an existing DX11 application.
This application produces a single eyefov (perfectly working) to which I would like to add a quad containing some data.
I have to say this this is my first project involving libOVR and I have very little understaing of DX11.
These are the steps I'm following...
During initialization:
1. allocated a swapchain with ovr_CreateTextureSwapChainDX during initialization. Which resulted in a length of 3 elements
2 got the ID3D11Texture2D from each swapchain buffer (via ovr_GetTextureSwapChainBufferDX)
3. create an ID3D11RenderTargetView for each buffer
4. created an ovrLayerQuad structure of ovrLayerType_Quad type, ovrLayerFlag_HighQuality flags and the swapchain as ColorTexture
For Each Frame:
1. Got the current swapchain index via ovr_GetTextureSwapChainCurrentIndex
2. cleared the indexed target view via ClearRenderTargetView with color { 1.0f, 0.0f, 0.0f, 1.0f }
3. submitted the swapchain with ovr_CommitTextureSwapChain
4. added the ovrLayerQuad structure to the array prepared by the existing code (and yes, I managed its size)
5. let the underlying code to submit the frame via ovr_SubmitFrame with updated array and layerCount
Each result has been checked for errors (where available)
What I see from my logs is:
- frame 1 (index 0) is ok,
- from frame 2 on I receive error -1005 (NULL texture provided to ovrLayerType_Quad) from ovr_SubmitFrame
- from frame 4 (back to index 0) on I receive the error -6001 (There is no room in the texture swapchain to accept more frames..) from ovr_CommitTextureSwapChain
This behavior doesn't match anything I see in documentation and tutorials I see.
Why is SubmitFrame complaining about a NULL texture? I expected the swapchain to allocate all of them and the ClearRenderTargetView to fill each by color.
What am I missing?
Thank you for any hint because I'm really out of ideas right now.