TL;DR: Swapchain updates seem to have no effect when the primary XR window is not focused, or perhaps simply when a secondary window for the same process is focused.
Long Version:
In order to avoid having to do massive OpenGL state resets between using one library for user interface rendering and another for scene rendering, the samples attempt to do UI rendering in a separate OpenGL context & thread that shares resources with the primary context.
The GLFW idiom for creating an offscreen rendering context is simply to create an additional GLFW window that is never shown on screen. So in the current UI testing example I
- create the primary GL context
- create the XR session using that context
- create the UI GL context and make it current
- create the XR swapchain and framebuffer with the UI GL context active
- acquire the first swapchain image and clear it with a distinctive color
- make the NO GL context current on the main thread
- launch the UI thread
- make the main GL context current again and continue with normal startup
In the UI thread I
- make the UI GL context current
- enter a loop that waits for a frame to be requested from the main thread
- when a request occurs, acquire a swapchain image and render to it
I've tried variations on this ordering, specifically whether the swapchain is created in the main GL context, or in the UI context, and when created in the UI context, whether it's created on the main thread or in the UI thread. The framebuffer that uses the swapchain images must be created on the UI context since FBO objects are not shared between contexts. However, the location of the swapchain creation doesn't seem to matter.
When I do this I often notice that the in-HMD quad does not have the desired content on it, but flickers between black and the distinctive color used for the first swapchain image clear. In the logs I noticed the line
06/10 10:47:20.810 {INFO} [Kernel:Default] [HMDState] Detected the active window handle changed to 7e07f0ll
When I saw this, I tried clicking the primary window created by my examples and then saw that the swapchain images were now updating properly in the HMD.