Skip to content

Commit

Permalink
fix(mvk): resumeLostDevice (#4800)
Browse files Browse the repository at this point in the history
Command buffer errors currently trigger an exception "DeviceLost" crashing the process.

Looking at [MKV's code](https://github.com/KhronosGroup/MoltenVK/blob/53a4eb26f2fbd7322eb087eb4af263fe466543b0/MoltenVK/MoltenVK/GPUObjects/MVKQueue.mm#L392-L408) we observe that:
- It hard fails if error is:
  ```
   MTLCommandBufferErrorBlacklisted || MTLCommandBufferErrorNotPermitted || MTLCommandBufferErrorDeviceRemoved
   ```
- Otherwise fails conditionally if `config.resumeLostDevice == false` (current default)

For Ryujinx's use-case it's more graceful to resume on those errors rather than crashing the app, the error isn't totally silenced since `mvk` still logs it

Fixes #4704, #4575
  • Loading branch information
AaronO committed May 10, 2023
1 parent 0bc8151 commit a7c6e6a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Ryujinx.Graphics.Vulkan/MoltenVK/MVKInitialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public static void Initialize()
config.SemaphoreSupportStyle = MVKVkSemaphoreSupportStyle.MVK_CONFIG_VK_SEMAPHORE_SUPPORT_STYLE_SINGLE_QUEUE;
config.SynchronousQueueSubmits = false;

config.ResumeLostDevice = true;

vkSetMoltenVKConfigurationMVK(IntPtr.Zero, config, configSize);
}
}
Expand Down

0 comments on commit a7c6e6a

Please sign in to comment.