Debugging a simple openxr layer for FoV tangent

Hi all,

I am interested in creating an openxr layer to implement FoV tangent so that I can present my square ratioed BigScreenBeyond (2560x2560 per eye) as having a widescreen ratio (2560x1440) and just blank out the region outside of that. The goal being to reduce the computational overhead involved with rendering unnecessary detail for simracing (where even in real world racing, these areas are not visible because of the helmet being worm by the driver)

OpenXR-Toolkit (which has been closed down) has a feature that sounds, at first glance, suspiciously like this. But it’s not. It just masks the upper and lower regions and doesn’t provide a performance boost. I asked the author of OXR-TK and he suggested forking his repository which I have done here

GitHub - fommil/openxr-widescreen: An OpenXR layer to alter the FOV tangent (i.e. rendered area) to be widescreen

and then modifying it like this

Doing FOV Tangent from there is pretty simple if you only target OpenXR runtimes that have fovMutable (see OpenXR spec for a description of what that means, and I believe SteamVR does support that, you can use OpenXR Explorer to inspect this capability). To do the FOV Tangent, all you need to do is hook xrEnumerateViewConfigurationViews() and compute the reduced resolution corresponding to the modified FOV. The rest of the fov_modifier code above should remain the same.

However, I’m stuck at the first hurdle. Even though I’ve been able to build his repo on my dev machine, and install it implicitly on my gaming machine (in the registry). However, it isn’t showing up in the layers tab in SteamVR (am I expecting too much there?) and when I try to start my VR game (iRacing) the VR headset won’t start up. If I disable the plugin, the VR game works again so clearly something is not working in the layer code.

I have no idea how to debug this, I don’t know where the logs go. Where is the first place for me to look?

I’ve tried running the version of the code directly as forked from the OXR-TK author, but also with some modifications. It has exactly the same impact. I would note that although I know a bunch of other programming languages, I don’t know C++ or the OpenXR API so in this instance I cheated and used chatgpt to help me with the modifications he suggested. It looks very much like what he suggested, and it compiles, but I can’t be sure it is doing exactly what is needed… but that shouldn’t really matter at this stage because I can’t even get his code to work as-is.

Reading the code, the logs should be showing up in

            std::string logFile = (std::filesystem::path(getenv("LOCALAPPDATA")) / std::filesystem::path(LayerName + ".log")).string();
            logStream.open(logFile, std::ios_base::ate);

but I can’t see anything.

For the layer to show up in the SteamVR settings, all that is required is that the registry key points to the location of the layer .json file. SteamVR doesn’t seem to check for the DLL. If the layer isn’t showing up, either the path is wrong, the .json file has an error, or there is some kind of permission issue. The .json file in the repo looks correct at least.

Hmm, I’m still not seeing it in the SteamVR list of overlays. But it’s working, and I can see it in OpenXR-Explorer. Which registry keys do you mean? I’m using

HKLM\Software\Khronos\OpenXR\1\ApiLayers\Implicit

(I updated the README with a lot more info about this for developers)

Just an update incase anybody was going to spend time digging into this: I fixed it. It turns out I was using an older dynamically linked Debug build and I didn’t have the DLLs on my game machine. So I swapped to static builds and it loaded up after that (but still not visible in SteamVR, which is a minor point I think).

Oh, it should appear in the layer list in the OpenXR tab (only accessible from the desktop widget), instead of the overlay list.

Glad you got it working though!

Hmm, I’m pretty sure it’s not there but it could be sensitive to machine restarts and I’ve been doing a lot of hot swapping. I’ll check again when I’m next on the gaming machine.

I checked and it’s still not there, even after a reboot. Layer is still loading implicitly though.