I have two images, image A and image B. I am trying to display them sequentially on top of the submitted layers so it looks like this.
- Acquire submitted layer from OpenVR
- Overlay image A on top of the submitted layer
- Present
- Acquire submitted layer from OpenVR
- Overlay image B on top of the submitted layer
- Present
The thing is when I display images sequentially I get this weird flickering artifact.
This artifact is irregular, sometimes appears in brigth tones and sometimes appears in black tones.
Here's what have done/know so far.
- If I dont dont overlay images and use the submitted layers directly then there is no flicker.
- I have saved the rendered images to my harddisk and checked if any of these composed images have some artifacts that may cause this flickering issue. There is no artifact with the images, there is no coloring issues and no double images. So I present images in correct order and there is no image that is displayed twice or out of order.
- I have tested outputting every second image I display as a solid red image, this would also result in having the artifacts. So the problem is not specific to my overlayed images.
- I have checked the submitted layers, they are submitted in expected order so there is no order problem with the submitted layers
- I have tested presenting image A or image B as a standalone texture instead of using the sumbitted layers, there was no flickering.
- I have tested presenting image A and image B in sequentially without overlaying them on top of the submitted layers, this results in flickering.
- I have testing presenting my images as a solid color, there was no flicker. If I present images in red and green color sequantially then the flickering artifact appears.
It seems like whenever I present image that is somewhat different from the last presented image the flickering issue appears.
I am wondering if there is some sort of behaviour with the general monitor technology or OpenVR direct mode bug that results in flickering images when I present two different images sequentially.
Any direction or idea would be appreciated.
Edit 0
It seems that flickering images are the past presented images from the swapchain. Even though I wait for Vsync and Present mutexes provided from the api it somehow displays the past presented images. I have tried to reproduce the bug without the openvr with barebone directx11 implementation but the flickering is not there, so it's unlikely the flickering is product of my code.