# Why does Intercept Vulkan vkCreateInstance crash

**URL:** https://discussions.unity.com/t/why-does-intercept-vulkan-vkcreateinstance-crash/921997
**Category:** Device, Driver, & APIs
**Tags:** Question
**Created:** [June 29, 2023, 10:01am UTC](https://discussions.unity.com/t/why-does-intercept-vulkan-vkcreateinstance-crash/921997 "2023-06-29T10:01:51Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![chaoshi](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@chaoshi](https://discussions.unity.com/u/chaoshi)
#### Post date: [June 29, 2023, 10:01am UTC](https://discussions.unity.com/t/why-does-intercept-vulkan-vkcreateinstance-crash/921997/1 "2023-06-29T10:01:51Z")

</div>

I cloned the NativeRenderingPlugin project from GitHub, modified the #define SUPPORT\_VULKAN 0 to 1 in PlatformBase.h file, compiled RenderingPlugin.dll based on Vulkan SDK 1.3 in Visual Studio 2022 Community, and set the dll file to load on startup in the Unity project. However, every time I open the project it crashes. After multiple tests, I found that it always crashes when executing Hook\_vkCreateInstance() function in RenderAPI\_Vulkan.cpp, even after switching to different Unity versions.

When checking the Editor.log file, the log for Unity 2022.3 is  
========== OUTPUTTING STACK TRACE ==================

0x00007FF75E6130C8 (Unity) winutils::ExternalCrashHandler::HandleCrash  
0x00007FF75E6131E1 (Unity) winutils::ExternalCrashHandler::HandleFatal  
0x00007FF75E62294A (Unity) winutils::CrashHandler:😄efaultSignalHandler  
0x00007FF760A3BE38 (Unity) seh\_filter\_exe  
0x00007FF760AFF768 (Unity) `__scrt_common_main_seh'::`1’::filt$0  
0x00007FF760A057D0 (Unity) \_C\_specific\_handler  
0x00007FFFCAD8184F (ntdll) \_chkstk  
0x00007FFFCAD4A889 (ntdll) RtlRaiseException  
0x00007FFFCAD804BE (ntdll) KiUserExceptionDispatcher

the log forunity2023.1.1 is  
========== OUTPUTTING STACK TRACE ==================

0x00007FFEF5386976 (NVUnityPlugin) NVSDK\_NGX\_Parameter\_SetD3d11Resource  
0x00007FFEF5386F07 (NVUnityPlugin) NVSDK\_NGX\_Parameter\_SetD3d11Resource  
0x00007FFEEF8BA913 (RenderingPlugin) [H:\nativerenderingplugin\PluginSource\source\RenderAPI\_Vulkan.cpp:103] Hook\_vkCreateInstance  
0x00007FFEA9EB4A2A (Unity) `anonymous namespace’::CreateInstance  
0x00007FFEA9EB7B35 (Unity) vk::Initialize  
0x00007FFEA9EC60E2 (Unity) CreateVKGfxDevice  
0x00007FFEA9B282CA (Unity) CreateRealGfxDevice  
0x00007FFEA9E1793E (Unity) CreateClientGfxDevice  
0x00007FFEA9B281DD (Unity) CreateGfxDevice  
0x00007FFEA9B2AD7F (Unity) InitializeGfxDevice  
0x00007FFEA9894D6D (Unity) InitializeEngineGraphics  
0x00007FFEAA835239 (Unity) Application::InitializeProject  
0x00007FFEAACA8F85 (Unity) UnityMain  
0x00007FF672A429FA (Unity) \_\_scrt\_common\_main\_seh  
0x00007FFFC9EB7C24 (KERNEL32) BaseThreadInitThunk  
0x00007FFFCAD4D4D1 (ntdll) RtlUserThreadStart

I hope to customize vkCreateinstance and vkCreateDevice. How can I solve the crash issue?

---

<div class="post-metadata">

### Author: ![NoWow](https://avatars.discourse-cdn.com/v4/letter/n/3ab097/32.png) [@NoWow](https://discussions.unity.com/u/NoWow)
#### Post date: [August 17, 2023, 2:51am UTC](https://discussions.unity.com/t/why-does-intercept-vulkan-vkcreateinstance-crash/921997/2 "2023-08-17T02:51:49Z")

</div>

I met the same problem when I set the NativeRenderPlugin to preload. I have the same requirement to customize vkCreateinstance and vkCreateDevice. And I try to enable Validation layer in VkInstanceCreateInfo when calling vkCreateinstance but nothing written.

---

<div class="post-metadata">

### Author: ![Rilliane](https://avatars.discourse-cdn.com/v4/letter/r/51bf81/32.png) [@Rilliane](https://discussions.unity.com/u/Rilliane)
#### Post date: [March 26, 2024, 7:43am UTC](https://discussions.unity.com/t/why-does-intercept-vulkan-vkcreateinstance-crash/921997/3 "2024-03-26T07:43:47Z")

</div>

I also have the same problem.I want to know the solution too.

---

<div class="post-metadata">

### Author: ![l1q](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@l1q](https://discussions.unity.com/u/l1q)
#### Post date: [August 3, 2024, 12:55pm UTC](https://discussions.unity.com/t/why-does-intercept-vulkan-vkcreateinstance-crash/921997/4 "2024-08-03T12:55:52Z")

</div>

I also have the same problem 😫

---

<div class="post-metadata">

### Author: ![xingcid](https://avatars.discourse-cdn.com/v4/letter/x/b38774/32.png) [@xingcid](https://discussions.unity.com/u/xingcid)
#### Post date: [August 14, 2024, 9:22am UTC](https://discussions.unity.com/t/why-does-intercept-vulkan-vkcreateinstance-crash/921997/5 "2024-08-14T09:22:23Z")

</div>

Just found the soultion

> [@Enabling VK\_KHR\_draw\_indirect\_count in Vulkan](https://discussions.unity.com/t/enabling-vk_khr_draw_indirect_count-in-vulkan/777505/6):
>
> Hi @florianpenzkofer , I’m trying to get the vkCreateDevice hook working, but it seems like the device has already been created by the time the plugin is loaded. if (s\_Graphics-\>GetRenderer() == kUnityGfxRendererNull) { extern void RenderAPI\_Vulkan\_OnPluginLoad(IUnityInterfaces\*); RenderAPI\_Vulkan\_OnPluginLoad(unityInterfaces); } At this point, s\_Graphics-\>GetRenderer() returns kUnityGfxRendererVulkan, and even if I force it into RenderAPI\_Vulkan\_OnPluginLoad, the vkCreateDevice hook is not c…

---

<div class="post-metadata">

### Author: ![chaoshi](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@chaoshi](https://discussions.unity.com/u/chaoshi)
#### Post date: [October 16, 2024, 8:08am UTC](https://discussions.unity.com/t/why-does-intercept-vulkan-vkcreateinstance-crash/921997/6 "2024-10-16T08:08:45Z")

</div>

When I upgraded my graphics card from 1060 to 2060, the problem was solved. So, could this be a bug in the graphics card driver?
