Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Why does Intercept Vulkan vkCreateInstance crash

Discussion in 'General Graphics' started by chaoshi, Jun 29, 2023.

  1. chaoshi


    Nov 15, 2022
    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::DefaultSignalHandler
    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?
  2. NoWow


    Jun 26, 2023
    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.
  3. Rilliane


    Oct 19, 2018
    I also have the same problem.I want to know the solution too.