stride icon indicating copy to clipboard operation
stride copied to clipboard

Virtual Reality template example doesn't work using vulkan renderer

Open arturoc opened this issue 2 years ago • 3 comments

Release Type: Github versions

Version: Happens on latest stable (using master-4.0 branch) and on latest master

Platform(s): Windows

Describe the bug When trying to run the VR template using the vulkan renderer the example freezes and starts to leak memory until it crashes

To Reproduce Steps to reproduce the behavior:

  1. Compile GameEditor from any of the indicated branches adding Vulkan to StrideGraphicsApi in Stride.Build.props https://github.com/stride3d/stride/blob/master/build/Stride.Build.props
  2. Create a new example from the VR template
  3. Change the StrideGraphicsApi to vulkan in the new example by adding: <StrideGraphicsApi>Vulkan</StrideGraphicsApi> to the frist PropertyGroupin VRSandbox.Windows\VRSandboxWindows.csproj
  4. Run the example
  5. The window appears, the console shows how the shaders are compiled but the output doesn't appear on the VR device and starts to leak memory until it crashes with a corrupted memory error.

Expected behavior The example should run correctly and show the output in the VR device as it works when using directx instead of vulkan.

Additional context This happens when running the application using the steam VR null driver by setting it up in Program Files\Steam\config\steamvr.settings using :

   "driver_null" : {
      "enable" : true,
      "id" : "Null Driver",
      "windowHeight" : 1080,
      "windowWidth" : 1920,
      "windowX" : 100,
      "windowY" : 100
   },

The same device setup works fine when using direct x, when running the example the steam vr window appears and the output of the application shows up in the monitor emulating the VR device.

arturoc avatar May 06 '22 14:05 arturoc

Do you know which VR API it's using? Could it be that the problem is with the VR API itself rather than Vulkan? (if yes, even if fixed, it won't help with your future work on OpenXR since it will be replaced by something else?)

xen2 avatar May 06 '22 15:05 xen2

Could be but it doesn't seem to even be initializing the VRDeviceSystem inside Game. Not 100% sure that's where the VR system is initialized but that class is not even constructed before the example crashes.

I've also tried with this PR https://github.com/stride3d/stride/pull/1107 modifying the Main function so it selects openxr like:

using Stride.Engine;
using Stride.VirtualReality;

namespace VRSandbox_PR_vulkan
{
    class VRSandbox_PR_vulkanApp
    {
        static void Main(string[] args)
        {
            using (var game = new Game())
            {
                game.VRDeviceSystem.PreferredApis = new VRApi[] { VRApi.OpenXR };
                game.Run();
            }
        }
    }
}

And i'm having the same problem with the app crashing after a few seconds due to a memory leak.

Again not 100% sure this is the correct way to choose the VR api but it looks so from the code.

arturoc avatar May 06 '22 16:05 arturoc

for reference, @phr00t was suggesting on discord to use a basic new game and to enable VR on that. Just to exclude that the VR example has some other issue that might not be related to the VR implementation.

tebjan avatar May 10 '22 12:05 tebjan