Search Unity

Bug XR Is allocating

Discussion in 'VR' started by Max-om, Jan 27, 2022.

  1. Max-om

    Max-om

    Joined:
    Aug 9, 2017
    Posts:
    499
    This could be a bug with SteamVR, but Im pretty sure its a bug with Unity XR. I placed a bug over att SteamVR too.

    XR framework allocates

    This is a built player I benchmark

    upload_2022-1-27_12-2-17.png
     
  2. Max-om

    Max-om

    Joined:
    Aug 9, 2017
    Posts:
    499
    ops, forgot to exapnd the first allocation

    upload_2022-1-27_12-3-36.png
     
  3. NemesisWarlock

    NemesisWarlock

    Joined:
    Jan 21, 2017
    Posts:
    141
    You're going to have to be more specific here. This looks like a completely normal Profiler pass?
     
  4. Max-om

    Max-om

    Joined:
    Aug 9, 2017
    Posts:
    499
    It allocates 304 bytes every frame
     
  5. NemesisWarlock

    NemesisWarlock

    Joined:
    Jan 21, 2017
    Posts:
    141
    again, what's the actual *issue* here? Is the scene not showing up in the headset? is it not rendering correctly? is it mysteriously taking up not *enough* memory? Rubber duck this thing for me, what's the intended result?
     
  6. Max-om

    Max-om

    Joined:
    Aug 9, 2017
    Posts:
    499
    It shouldn't allocate since it creates garbage that will cause spikes when collected. Our game has zero allocation (It offcourse allocates but those references are referenced and not dead). This is now our only point were the game allocates.
     
  7. NemesisWarlock

    NemesisWarlock

    Joined:
    Jan 21, 2017
    Posts:
    141
    Wait.

    Are you complaining because your game is garbage collecting *under a kilobyte total per frame*?!

    Developers would MURDER for that level of performance!

    Holy crap...

    Regardless, you can take complete control of the GC system, if you *really, desperately* think you want even *lower* memory allocation.

    https://docs.unity3d.com/Manual/performance-garbage-collector.html
     
  8. Max-om

    Max-om

    Joined:
    Aug 9, 2017
    Posts:
    499
    Well, the problem is that XR/SteamVR allocates, it shouldn't. I can't hardly believe there is a valid reason for it to allocate every single frame. VR is extra sensitive to spikes because of reprojection so it's even more important in VR
     
  9. NemesisWarlock

    NemesisWarlock

    Joined:
    Jan 21, 2017
    Posts:
    141
    As long as your user gets 72,90, or 120FPS depending on their hardware, the fact that there's a minor memory allocation bug in SteamVR should not be an issue. Unity doesn't make the SteamVR Plugin, Valve does, you'll need to contact them, however they don't actively support/develop the SteamVR Render Plugins anymore, as they've moved to OpenXR (So has Oculus.) Consider avoiding SteamVR entirely and using OpenXR.
     
  10. Max-om

    Max-om

    Joined:
    Aug 9, 2017
    Posts:
    499
    The allocation comes from the Unity side, get devices. We use OpenXR plugin with XR Manager (The only way to use VR since 2020)

    If you allocate you will get spikes at uncontrolled tiles during the frame and that will lead to reprojection. The API shouldn't allocate every single frame.
     
  11. Max-om

    Max-om

    Joined:
    Aug 9, 2017
    Posts:
    499