fredemmott / HTCC

Hand tracking for flight simulator cockpit clicking
https://htcc.fredemmott.com/
MIT License
56 stars 3 forks source link

Touch screen emulation (only available for DCS) assumes parallel stereo views #41

Closed mspain007 closed 10 months ago

mspain007 commented 1 year ago

When using @mbucchia's https://github.com/mbucchia/Varjo-Foveated/wiki with HTCC, DCS hangs (white screen, Not Responding in Task Manager). Varjo-Foveated log below: 2023-04-15 22:48:14 -0400: XR_APILAYER_MBUCCHIA_varjo_foveated layer (v0.1.0) is active 2023-04-15 22:48:14 -0400: Using layer: XR_APILAYER_MBUCCHIA_varjo_foveated 2023-04-15 22:48:14 -0400: Application: FREDEMMOTT_HTCC ultraleap compat hack 2023-04-15 22:48:14 -0400: XR_APILAYER_MBUCCHIA_varjo_foveated layer will be bypassed 2023-04-15 22:48:14 -0400: Using layer: XR_APILAYER_MBUCCHIA_varjo_foveated 2023-04-15 22:48:14 -0400: Requested extension: XR_KHR_D3D11_enable 2023-04-15 22:48:14 -0400: Requested extension: XR_KHR_visibility_mask 2023-04-15 22:48:14 -0400: Requested extension: XR_VARJO_quad_views 2023-04-15 22:48:14 -0400: Requested extension: XR_EXT_hand_tracking 2023-04-15 22:48:14 -0400: Requested extension: XR_KHR_win32_convert_performance_counter_time 2023-04-15 22:48:14 -0400: Requesting extension: XR_VARJO_foveated_rendering 2023-04-15 22:48:15 -0400: Application: DCS World 2023-04-15 22:48:15 -0400: Using OpenXR runtime: Varjo OpenXR Runtime 3.9.0 2023-04-15 22:48:15 -0400: Using OpenXR system: AERO 2023-04-15 22:48:15 -0400: supportsFoveatedRendering = 1 2023-04-15 22:48:15 -0400: Trying to locate configuration file at 'C:\Users\mark\AppData\Local\Varjo-Foveated\settings.cfg'... 2023-04-15 22:48:15 -0400: Not found 2023-04-15 22:48:15 -0400: Trying to locate configuration file at 'C:\Program Files\OpenXR-Varjo-Foveated\settings.cfg'... 2023-04-15 22:48:15 -0400: Found option 'peripheral_multiplier=1' 2023-04-15 22:48:15 -0400: Found option 'focus_multiplier=1' 2023-04-15 22:48:15 -0400: Found option 'turbo_mode=1' 2023-04-15 22:48:15 -0400: Found option 'no_eye_tracking=0' 2023-04-15 22:48:15 -0400: Peripheral resolution: 1908x1632 (multiplier: 1.000) 2023-04-15 22:48:15 -0400: Focus resolution 1140x1140 (multiplier: 1.000) 2023-04-15 22:48:15 -0400: Peripheral resolution: 1908x1632 (multiplier: 1.000) 2023-04-15 22:48:15 -0400: Focus resolution 1140x1140 (multiplier: 1.000) 2023-04-15 22:48:17 -0400: Creating swapchain with resolution: 1908x1632 2023-04-15 22:48:17 -0400: Creating swapchain with resolution: 1908x1632 2023-04-15 22:48:17 -0400: Creating swapchain with resolution: 1140x1140 2023-04-15 22:48:17 -0400: Creating swapchain with resolution: 1140x1140 2023-04-15 22:48:20 -0400: xrLocateViews failed with XR_ERROR_SIZE_INSUFFICIENT

mbucchia commented 1 year ago

Ignore this error message. It's not necessarily indicative of a problem.

What if you run DCS without Varjo foveated but with OpenXR enabled (ie just quad views)?

fredemmott commented 1 year ago

HTCC isn’t handling quad views; when not using controller emulation, it cares as it needs to calculate the FOV for touch screen emulation

fredemmott commented 1 year ago

From a brief look, I'm not sure this is on HTCC's end: HTCC is calling xrLocateViews with an XrViewLocateInfo which specifies XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO; as this is reported by xrEnumerateViewConfigurations - even when quad views is in use - AIUI this should be valid; it definitely shouldn't lead to attempting to fetch 4 views (which I'm assuming is what's happening, leading to the XR_ERROR_SIZE_INSUFFICIENT).

fredemmott commented 1 year ago

Ignore this error message

Ah sorry, both?

2023-04-15 22:48:14 -0400: XR_APILAYER_MBUCCHIA_varjo_foveated layer will be bypassed 2023-04-15 22:48:20 -0400: xrLocateViews failed with XR_ERROR_SIZE_INSUFFICIENT

mbucchia commented 1 year ago

Ignore this error message

Ah sorry, both?

2023-04-15 22:48:14 -0400: XR_APILAYER_MBUCCHIA_varjo_foveated layer will be bypassed 2023-04-15 22:48:20 -0400: xrLocateViews failed with XR_ERROR_SIZE_INSUFFICIENT

The first message probably only applies to your fake workaround XrInstance.

The second message is a log check that is too strict. Returning XR_ERROR_SIZE_INSUFFICIENT is acceptable when viewCapacityInput == 0 is passed. This message isn't an indication of an error happening in Varjo-Foveated, and the user needs to follow the instructions to try to reproduce with just DCS and HTCC.

From a brief look, I'm not sure this is on HTCC's end: HTCC is calling xrLocateViews with an XrViewLocateInfo which specifies XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO; as this is reported by xrEnumerateViewConfigurations

Varjo-Foveated isn't returning this error AFAICT, the Varjo OpenXR runtime is. While I agree with you that the spec isn't forbidding explicitly what you are describing, I believe this is treated as an error by the runtime. I can't really tell if this is a "spec bug" or a runtime bug. I can't think of a valid reason an app would set QUAD as it's primary view configuration type in xrBeginSession(), then use a different one for locating views. I would have expected you to get an XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED to be honest. I don't know why the spec seems to allow it, that seems wrong.

mbucchia commented 1 year ago

See here

https://github.com/mbucchia/Varjo-Foveated/blob/492cd389d250f2354d2577d91d17779d8b5d5100/XR_APILAYER_MBUCCHIA_varjo_foveated/layer.cpp#L343

Varjo-Foveated does nothing about the XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO queries, it just passes it through to the runtime.

mspain007 commented 1 year ago

Thank you both for looking into this. Slammed with meetings but will test DCS with OpenXR and HTCC this evening and report back. I do know that combo was working with a Reverb G2 before I got the Varjo Aero. I went straight to the Varjo foveated when I got the Aero so will test and let you guys know!

Thanks again! :)

mspain007 commented 1 year ago

Gentlemen an update on this... DCS is still hanging without Varjo-Foveated installed. Running just Varjo base with OpenXR enabled in it and HTCC enabled with "Virtual touch screen or tablet" selected (so none of Matthieu's tools loaded), DCS hangs with a white screen (grey in Varjo headset) and Not Responding in Task Manager.

DCS does work with HTCC set to "Virtual Oculus Touch VR controller". BTW, HTCC works fine in MSFS2020 in touch screen mode so this is just DCS/touch screen mode only. Should we update this issue to HTCC touch screen mode and Varjo OXR compatibility in DCS?

Again thank you both for taking the time to troubleshoot this, not to mention the countless hours developing these invaluable tools! You guys both rock! :)

If you come up with something or would like me to test further please let me know. Otherwise I am ok using Oculus controller mode as a workaround (prefer touch screen though!).

fredemmott commented 1 year ago

HTCC works fine in MSFS2020 in touch screen mode

Unless you've edited the registry, MSFS always uses controller emulation, regardless of the preference in the settings app.

fredemmott commented 1 year ago

Also likely to be incorrect on Pimax, but I wouldn't expect it to not work at all, except on Varjo

fredemmott commented 10 months ago

Fixed a while back in master builds and in next version