OpenXR API Layers cause gamethread lag / high CPU frametime and lag spikes

I don’t use or need these layers but enabling any one of these causes massive amount of lag. It makes the CPU frametime go from normal 3ms to consistant 10-15ms and there are spikes every 30-60 seconds where it jumps to 150ms+ for few frames.
What is strange is that pressing the steam VR button on the controller to open the steam window makes the frametime to go back down to normal.


The unreal insights tells me that the problem is STAT_FEngineLoop_Tick_PollGameDeviceState
so in the PollGameDeviceState()
there is this:

for( auto DeviceIt = ExternalInputDevices.CreateIterator(); DeviceIt; ++DeviceIt )
{
    (*DeviceIt)->Tick( TimeDelta );
    (*DeviceIt)->SendControllerEvents();
}

So I assume that the engine sees the layers and ticks the devices that don’t even exist… idk
When you comment out this code, the lag goes away but you can’t use your VR controllers anymore.
Do I really have to tell the player somehow in the mainmenu to go disable the extra OpenXR layers to fix the lag? Or is there away to block them in the engine?

I use OpenXR, all hand tracking, eye tracking etc plugins are disabled.

When you open the dashboard, the games OpenXR session loses focus, which means it doesn’t receive any inputs per the OpenXR spec, and SendControllerEvents()exits early.

You can disable specific API layers by setting the environment variable found in the layers JSON manifest file under the disable_environment key. The locations for the installed layers can be found in the Windows registry under: HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenXR\1\ApiLayers\Implicit

The Vive API layers are notorious for working poorly when you are using a different headset than a Vive model the layers support. They should not be present for most users though, unless they have used one of the newer Vive headsets in the past and still have the software for it installed.