Search Issue Tracker
Duplicate
Votes
1
Found in
2020.3
2020.3.24f1
2021.2
2022.1
2022.2
Issue ID
1393378
Regression
No
IUnityGraphicsVulkan::InterceptInitialization() stops working after OpenXR is installed and is not supported by multiple plugins
Reproduction steps:
1. Open the user's attached project "AndroidVulkanInterceptInitializationRepro.zip"
2. Make sure OpenXR is uninstalled from the project
3. Build for Quest 1/2 and check Android Logcat for "InterceptVulkanInitialization called"
4. Install OpenXR
5. Build for Quest 1/2 and check Android Logcat for "InterceptVulkanInitialization called"
Expected result: IUnityGraphicsVulkan::InterceptInitialization() is called after installing OpenXR and can be supported by multiple plugins
Actual result: IUnityGraphicsVulkan::InterceptInitialization() stops working after OpenXR is installed and is not supported by multiple plugins
Reproduces on: 2020.3.31f1, 2021.2.15f1, 2022.1.0b11, 2022.2.0a6
Could not test on 2019.4.36f1 since OpenXR is not available
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [Mobile] Developer Console does not appear when an error is thrown
- [HDRP] Game view renders artifacts when Camera's Component "Post Anti-aliasing" is set to "TAA" and Dynamic Resolution's "Forced Screen Percentage" is changed
- A deactivated Prefab's name color becomes white when a GameObject in the scene is deactivated
- The Game view becomes blank when using Frame Debugger with MSAA and Texture binding enabled in Play Mode
- NullReferenceException is thrown when changing the Inspector preview selection
Resolution Note (2020.3.X):
Latest versions of IUnityGraphicsVulkan.h have a new IUnityGraphicsVulkan2 interface to solve this problem:
// Vulkan API hooks
//
// Must be called before kUnityGfxDeviceEventInitialize (preload plugin)
// Unity will call 'func' when initializing the Vulkan API
// The 'getInstanceProcAddr' passed to the callback is the function pointer from the Vulkan Loader
// The function pointer returned from UnityVulkanInitCallback may be a different implementation
// This allows intercepting all Vulkan API calls
// The priority is used to sort multiple callbacks such that the highest priority will be called last
// with the original Vulkan loader implementation of vkGetInstanceProcAddress passed in as 'getInstanceProcAddr'.
// A priority value of `kUnityVulkanInitCallbackMaxPriority` is used to force a callback to be called immediately before
// the original Vulkan loader implementation of `vkGetInstanceProcAddress`. Only one callback can be registered with a
// priority of `kUnityVulkanInitCallbackMaxPriority`, if one already exists it will be replaced.
// Passing a priority value of `kUnityVulkanInitCallbackMaxPriority` is equivalent to calling the `InterceptInitialization` method.
//
// Most rules/restrictions for implementing a Vulkan layer apply
// Returns true on success, false on failure (typically because it is used too late)
bool(UNITY_INTERFACE_API * AddInterceptInitialization)(UnityVulkanInitCallback func, void* userdata, int32_t priority);
// Remove vulkan intercept initialization callback.
// Removal will not take effect until the next time vulkan is initialized.
bool(UNITY_INTERFACE_API * RemoveInterceptInitialization)(UnityVulkanInitCallback func);
This shipped in 2022.1.0a7, 2021.2.0b9, 2020.3.17f1 (~August - September 2021 timeframe)