Jump to content

Vive Cosmos OpenXR + OpenGL crashes with Memory Acces Violation


Courgeon

Recommended Posts

Hello, 

I'm trying to use the Cosmos with our OpenGL engine (c# based), and using OpenXR.

We have beeing using Steam OpenVR API for a while, but I'd like to use the Alpha Blend mode using Vive OpenXR.

I managed to implement OpenXR in our engine, it works well with Oculus OpenXR (quest 2 + link), and with Steam OpenXR + Vive Cosmos. However, using the Vive OpenXR implementation as target, xrEndFrame crashes with

System.AccessViolationException
  HResult=0x80004003
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Any idea what's going on ?

M.


 

Link to comment
Share on other sites

Hi @Courgeon,

Since we cannot reproduce this issue when running "HelloXR-OpenGL-Alpha Blend mode" on VIVE Cosmos with VIVE OpenXR, some more information might help us to support you furthermore:

1. Provide your testing App if it is possible.

2. Provide the logs: Settings -> Trouble Shooting -> Report Issue. And provide the report number.

Thanks.

Link to comment
Share on other sites

If it can help here is the complete log of the XR calls

 

Verbose [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : Entering loader trampoline
Info [GENERAL |  | OpenXR-Loader] : RuntimeManifestFile::FindManifestFiles - using registry-specified runtime file C:\Program Files (x86)\VIVE\Updater\App\ViveVRRuntime\ViveVR_openxr\ViveOpenXR.json
Info [GENERAL |  | OpenXR-Loader] : RuntimeManifestFile::CreateIfValid - attempting to load C:\Program Files (x86)\VIVE\Updater\App\ViveVRRuntime\ViveVR_openxr\ViveOpenXR.json
Info [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : RuntimeInterface::LoadRuntime succeeded loading runtime defined in manifest file C:\Program Files (x86)\VIVE\Updater\App\ViveVRRuntime\ViveVR_openxr\ViveOpenXR.json using interface version 1 and OpenXR API version 1.0
Verbose [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : Completed loader trampoline
Enumerate number of extension properties : Success
Verbose [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : Entering loader trampoline
Verbose [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : Completed loader trampoline
Enumerate extension properties : Success
XR Runtime supports 19 extensions
  >> XR_EXT_hand_tracking  (version  2)
  >> XR_EXT_eye_gaze_interaction  (version  1)
  >> XR_HTC_facial_tracking  (version  1)
  >> XR_HTC_vive_srworks_pass_through  (version  1)
  >> XR_MSFT_scene_understanding  (version  1)
  >> XR_KHR_D3D11_enable  (version  9)
  >> XR_KHR_D3D12_enable  (version  9)
  >> XR_KHR_win32_convert_performance_counter_time  (version  1)
  >> XR_KHR_visibility_mask  (version  2)
  >> XR_HTC_vive_cosmos_controller_interaction  (version  1)
  >> XR_KHR_opengl_enable  (version  10)
  >> XR_KHR_vulkan_enable  (version  8)
  >> XR_KHR_vulkan_enable2  (version  2)
  >> XR_EXT_debug_utils  (version  4)
  >> XR_KHR_convert_timespec_time  (version  1)
  >> XR_KHR_composition_layer_depth  (version  6)
  >> XR_FB_passthrough  (version  3)
  >> XR_FB_triangle_mesh  (version  2)
  >> XR_EXT_win32_appcontainer_compatible  (version  1)
Verbose [GENERAL | xrCreateInstance | OpenXR-Loader] : Entering loader trampoline
Warning [GENERAL |  | OpenXR-Loader] : ReadLayerDataFilesInRegistry - failed to read registry location \ApiLayers\Explicit in either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER
Info [GENERAL | xrCreateInstance | OpenXR-Loader] : ApiLayerInterface::LoadApiLayers succeeded loading layer XR_APILAYER_VIVE_hand_tracking using interface version 1 and OpenXR API version 1.0
Info [GENERAL | xrCreateInstance | OpenXR-Loader] : ApiLayerInterface::LoadApiLayers succeeded loading layer XR_APILAYER_VIVE_facial_tracking using interface version 1 and OpenXR API version 1.0
Info [GENERAL | xrCreateInstance | OpenXR-Loader] : ApiLayerInterface::LoadApiLayers succeeded loading layer XR_APILAYER_VIVE_srworks using interface version 1 and OpenXR API version 1.0
Verbose [GENERAL | xrCreateInstance | OpenXR-Loader] : Entering LoaderInstance::CreateInstance
Verbose [GENERAL | xrCreateInstance | OpenXR-Loader] : Entering loader terminator
Verbose [GENERAL | xrCreateInstance | OpenXR-Loader] : Completed loader terminator
Info [GENERAL | xrCreateInstance | OpenXR-Loader] : LoaderInstance::CreateInstance succeeded with 3 layers enabled and runtime interface - created instance = 0x00000248ff495250
Verbose [GENERAL | xrCreateInstance | OpenXR-Loader] : Completed loader trampoline
Create XR instance : Success

Get OpenGL graphics requirements function : Success
Get XR instance info : Success
Runtime Name: Vive Reality Runtime
Runtime Version: 0.0.1
Get system for HMD form factor : Success
Successfully got XrSystem with id 1 for HMD form factor
Get System properties : Success
System properties for system 1
      Name                        : Vive OpenXR: Vive SRanipalcking
      VendorId                    : 2996
      Max Layers                  : 0
      Max swapchain height        : 0
      Max swapchain width         : 0
      Orientation Tracking        : 0
      Position tracking           : 0
Get view configuration view count : Success
Enumerate view configuration views : Success
View Configuration View :0
        Resolution          :
                Recommended       : 2757 x 3256
                Maximum           : 2757 x 3256
        Swapchain Samples   :
                Recommended       : 1
                Maximum           : 1
View Configuration View :1
        Resolution          :
                Recommended       : 2757 x 3256
                Maximum           : 2757 x 3256
        Swapchain Samples   :
                Recommended       : 1
                Maximum           : 1
Get OpenGL graphics requirements : Success
OpenGL Support :
                Minimum version       : 4.3.0
                Maximum version       : 4.6.1023
Using OpenGL version: 4.6.0 NVIDIA 517.48
Using OpenGL Renderer: NVIDIA GeForce RTX 3070 Ti/PCIe/SSE2
Create XR session : Success
Successfully created a session with OpenGL!

Create play space : Success
Get number of supported color swapchain formats : Success
Runtime supports 3 color  swapchain formats
Enumerate color  swapchain formats : Success
Supported GL color  format: Rgba8
Supported GL color  format: Srgb8Alpha8
Supported GL color  format: DepthComponent16Sgix
> Using preferred color  swapchain format Srgb8Alpha8
Get number of supported depth swapchain formats : Success
Runtime supports 3 depth  swapchain formats
Enumerate depth  swapchain formats : Success
Supported GL depth  format: Rgba8
Supported GL depth  format: Srgb8Alpha8
Supported GL depth  format: DepthComponent16Sgix
> Using preferred depth  swapchain format DepthComponent16Sgix
Create swapchain 0 : Success
Enumerate swapchains : Success
Enumerate swapchain images : Success
Create swapchain 1 : Success
Enumerate swapchains : Success
Enumerate swapchain images : Success
Create depth swapchain 0 : Success
Enumerate depth swapchains : Success
Enumerate depth swapchain images : Success
Create depth swapchain 1 : Success
Enumerate depth swapchains : Success
Enumerate depth swapchain images : Success
Create ActionSet : Success
Create hand pose action : Success
Create hand 0 pose space : Success
Create hand 1 pose space : Success
Attach action set : Success

Init scene loading

Scene loaded
Poll XR events : Success
Begin session : Success
Waiting for XR frame ready
XR wait frame ok
Wait XR frame : Success
Locate views : Success
Sync actions : SessionNotFocused
Begin frame : Success
fAcquire swapchain image : Success
Wait for swapchain image : Success
Acquire depth swapchain image : Success
Wait for depth swapchain image : Success
Using on left eye :
    Color : 0  ImageID : 1
    Depth : 0  ImageID : 7
Release swapchain image : Success
Release swapchain depth image : Success
fAcquire swapchain image : Success
Wait for swapchain image : Success
Acquire depth swapchain image : Success
Wait for depth swapchain image : Success
Using on right eye :
    Color : 0  ImageID : 4
    Depth : 0  ImageID : 10
Release swapchain image : Success
Release swapchain depth image : Success
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Silk.NET.OpenXR.XR.EndFrame(Silk.NET.OpenXR.Session, Silk.NET.OpenXR.FrameEndInfo*)
   at EGL.core.openxr.XR_Manager.EndFrame()
   at EGL.core.openxr.XR_Manager+<>c__DisplayClass54_0.<getRenderPassRight>b__1()
   at EGL.core.renderer.EGL_Renderpass+<>c.<doRender>b__29_1(System.Action)
   at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ForEach(System.Action`1<System.__Canon>)
   at EGL.core.renderer.EGL_Renderpass.doRender()
   at EGL.core.engine.EGL_Engine+<>c.<_initRenderProcess>b__71_4(EGL.core.renderer.EGL_Renderpass)
   at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ForEach(System.Action`1<System.__Canon>)
   at EGL.core.engine.EGL_Engine+<>c__DisplayClass71_0.<_initRenderProcess>b__0()
   at System.Threading.Thread.StartCallback()

 

Link to comment
Share on other sites

I found something quite interresting

All the examples I used as base were linking the depthInfo  (XrCompositionLayerDepthInfoKHR) to the projection_views (XrCompositionLayerProjectionView) using the "next" pointer

// depth is chained to projection, not submitted as separate layer

projection_views[i].next = &depth.infos[i];

However, It seems that the Vive OpenXR runtime does not allow that and crashes.

I just set next to null, and now it works.

 

 

Link to comment
Share on other sites

Thanks for pointing it out.

We do support this depth in the next pointer, but somehow it crashed.

Did you try our Beta? There might be a fix related to this issue.

And currently our runtime does not take OpenGL depth texture to perform anything, but App still can submit it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...