Why does Intercept Vulkan vkCreateInstance crash

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::smile: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?

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.

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

I also have the same problem :tired_face:

Just found the soultion

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?