weixin_39639174
weixin_39639174
2021-01-12 07:48

Launching Vulkan app, the application immediately closes without diagnostic error

Description

Launching my vulkan .exe from renderdoc, a window appears for a brief moment before closing. The diagnostic log ends with only the following warning: Core 15236 15:21:59 win32_network.cpp(258) Warning recv: WSAECONNRESET: An existing connection was forcibly closed by the remote host.

Note that the application runs perfectly (without even vulkan validation errors) in debug or release, when simply double clicked from its working directory (using the same .exe/working directory as specified with renderdoc)

(I've noticed that this behavior is essentially identical to the behavior noted here: https://github.com/baldurk/renderdoc/issues/1068 , though I'm unsure what "Ref All Resources" means)

Steps to reproduce

Set executable path, set working directory, hit "Launch". I unfortunately have no application capture beyond the diagnostic log, which is here:


Core 15236 15:21:33 core.cpp(421)           Log   RenderDoc v1.9 Windows 64-bit Release (22dbb188ceac48479764540ee0df3e4f28b6f0b3) loaded in replay application
Core 15464 15:21:33 core.cpp(421)           Log   RenderDoc v1.9 Windows 64-bit Release (22dbb188ceac48479764540ee0df3e4f28b6f0b3) loaded in replay application
Core 15464 15:21:33 settings.cpp(459)       Log   Loading config from C:\Users\phildo\AppData\Roaming\renderdoc\renderdoc.conf
Core 15236 15:21:33 crash_handler.h(150)    Log   Timer Waiting for crash handling server - 44.870 ms
Core 15236 15:21:33 crash_handler.h(156)    Log   Created crash-handling server \\.\pipe\RenderDocBreakpadServer17680950346
Core 15236 15:21:33 crash_handler.h(87)     Log   Connecting to server \\.\pipe\RenderDocBreakpadServer17680950346
Core 15236 15:21:33 settings.cpp(459)       Log   Loading config from C:\Users\phildo\AppData\Roaming\renderdoc\renderdoc.conf
UI 15236 15:21:33 qrenderdoc.cpp(89)      Log   QRenderDoc initialising.                          
Core 15236 15:21:33 crash_handler.h(51)     Log   Re-using crash-handling server \\.\pipe\RenderDocBreakpadServer17680950346
Core 15236 15:21:33 crash_handler.h(87)     Log   Connecting to server \\.\pipe\RenderDocBreakpadServer17680950346
Core 15236 15:21:33 d3d11_replay.cpp(122)   Log   Running replay on nVidia / NVIDIA GeForce GTX 1080 Ti 26.21.14.4187
Core 15236 15:21:33 d3d12_replay.cpp(101)   Log   Running replay on nVidia / NVIDIA GeForce GTX 1080 Ti 26.21.14.4187
Core 15236 15:21:33 android_tools.cpp(354)  Log   Initialising adb using 'C:\Users\phildo\AppData\Local\Android\Sdk\platform-tools\adb.exe'
Core 15236 15:21:34 vk_replay.cpp(4181)     Log   Created device.                                   
UI 15236 15:21:43 unknown(0)              Debug QWindowsNativeFileDialogBase::onSelectionChange (QUrl("file:///C:/Users/phildo/Desktop/projects/gnometower/gnometower.exe")) 1
UI 15236 15:21:43 unknown(0)              Debug QWindowsNativeFileDialogBase::onSelectionChange (QUrl("file:///C:/Users/phildo/Desktop/projects/gnometower/gnometower.exe")) 1
UI 15236 15:21:46 unknown(0)              Debug QWindowsNativeFileDialogBase::onSelectionChange (QUrl("file:///C:/Users/phildo/Desktop/projects/gnometower/gnometower")) 1
UI 15236 15:21:47 unknown(0)              Debug QWindowsNativeFileDialogBase::onSelectionChange (QUrl("file:///C:/Users/phildo/Desktop/projects/gnometower/x64")) 1
UI 15236 15:21:47 unknown(0)              Debug QWindowsNativeFileDialogBase::onSelectionChange () 0
UI 15236 15:21:48 unknown(0)              Debug QWindowsNativeFileDialogBase::onSelectionChange (QUrl("file:///C:/Users/phildo/Desktop/projects/gnometower/x64/Release")) 1
UI 15236 15:21:49 unknown(0)              Debug QWindowsNativeFileDialogBase::onSelectionChange (QUrl("file:///C:/Users/phildo/Desktop/projects/gnometower/x64/Debug")) 1
UI 15236 15:21:49 unknown(0)              Debug QWindowsNativeFileDialogBase::onSelectionChange (QUrl("file:///C:/Users/phildo/Desktop/projects/gnometower/x64/Debug/gnometower.exe")) 1
UI 15236 15:21:51 unknown(0)              Debug QWindowsNativeFileDialogBase::onSelectionChange (QUrl("file:///C:/Users/phildo/Desktop/projects/gnometower/x64/Debug/gnometower.exe")) 1
Core 15236 15:21:57 win32_process.cpp(514)  Log   Running process C:\Users\phildo\Desktop\projects\gnometower\x64\Debug\gnometower.exe
Core 15236 15:21:57 win32_process.cpp(597)  Log   Injecting renderdoc into process 1804             
Core 1804 15:21:57 core.cpp(421)           Log   RenderDoc v1.9 Windows 64-bit Release (22dbb188ceac48479764540ee0df3e4f28b6f0b3) capturing application
Core 1804 15:21:58 crash_handler.h(150)    Log   Timer Waiting for crash handling server - 45.449 ms
Core 1804 15:21:58 crash_handler.h(156)    Log   Created crash-handling server \\.\pipe\RenderDocBreakpadServer17928402568
Core 1804 15:21:58 crash_handler.h(87)     Log   Connecting to server \\.\pipe\RenderDocBreakpadServer17928402568
Core 1804 15:21:58 settings.cpp(459)       Log   Loading config from C:\Users\phildo\AppData\Roaming\renderdoc\renderdoc.conf
Core 1804 15:21:58 win32_libentry.cpp(66)  Log   Loading into C:\Users\phildo\Desktop\projects\gnometower\x64\Debug\gnometower.exe
Core 1804 15:21:58 sys_win32_hooks.cpp(82) Log   Registering Win32 system hooks                    
Core 1804 15:21:58 d3d11_hooks.cpp(125)    Log   Registering D3D11 hooks                           
Core 1804 15:21:58 d3d12_hooks.cpp(184)    Log   Registering D3D12 hooks                           
Core 1804 15:21:58 d3d8_hooks.cpp(36)      Log   Registering D3D8 hooks                            
Core 1804 15:21:58 d3d9_hooks.cpp(45)      Log   Registering D3D9 hooks                            
Core 1804 15:21:58 dxgi_hooks.cpp(250)     Log   Registering DXGI hooks                            
Core 1804 15:21:58 egl_hooks.cpp(977)      Log   Registering EGL hooks                             
Core 1804 15:21:58 gl_hooks.cpp(263)       Log   Registering OpenGL hooks                          
Core 1804 15:21:58 wgl_hooks.cpp(616)      Log   Registering WGL hooks                             
Core 1804 15:21:58 vk_layer.cpp(99)        Log   Registering Vulkan hooks                          
Core 1804 15:21:58 crash_handler.h(51)     Log   Re-using crash-handling server \\.\pipe\RenderDocBreakpadServer17928402568
Core 1804 15:21:58 crash_handler.h(87)     Log   Connecting to server \\.\pipe\RenderDocBreakpadServer17928402568
Core 15236 15:21:58 target_control.cpp(585) Log   Got remote handshake: gnometower [1804]           
Core 1804 15:21:58 core.cpp(1757)          Log   Adding Vulkan device frame capturer for 0x0000017593556BE0
Core 1804 15:21:58 vk_device_funcs.cpp(789) Log   Initialised capture layer in Vulkan instance.     
Core 1804 15:21:58 vk_device_funcs.cpp(1378) Log   physical device 0: GeForce GTX 1080 Ti (ver 441.87 patch 0x0) - 10de:1b06
Core 15236 15:21:59 win32_network.cpp(258)  Warning recv: WSAECONNRESET: An existing connection was forcibly closed by the remote host.

Environment

  • RenderDoc version: 1.9
  • Operating System: Windows 10
  • Graphics API: Vulkan SDK 1.2.135.0

该提问来源于开源项目:baldurk/renderdoc

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

7条回答

  • weixin_39639174 weixin_39639174 4月前

    I'm a tad out of my depth, so I appreciate your patience-

    I've been running my program with VK_LAYER_KHRONOS_validation layer, and have fixed every issue that comes up, so yes: I get no validation errors when I run the program normally. (Even when I attach the debugger to the renderdoc-launched program which crashes, the validation output is empty.)

    I'm unsure what you mean by "how am I obtaining the function pointer": https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkGetPhysicalDeviceProperties2.html shows it as a part of the vulkan 1.1 spec (right?). And I'm just linking w/ glfw and vulkan.lib, if that's what you're referring to?

    (Thanks for your help!)

    点赞 评论 复制链接分享
  • weixin_39639174 weixin_39639174 4月前

    I just realized that using vkGetPhysicalDeviceProperties(device, &deviceProperties.properties); (instead of vkGetPhysicalDeviceProperties2(device, &deviceProperties); works fine with renderdoc (and fortunately for what I need to debug at the moment, I don't require any information that vkGetPhysicalDeviceProperties2 gives). Figured I'd let you (and others) know!

    点赞 评论 复制链接分享
  • weixin_39531688 weixin_39531688 4月前

    Linking against a new loader provides the core vulkan 1.1 or 1.2 commands as exports as conveniences. However that then effectively internally calls vkGetInstanceProcAddr to fetch the function pointer, and you still must obey valid usage for that. That means it is invalid to call the returned function pointer for vkGetPhysicalDeviceProperties2 unless you have created at least a version 1.1 instance. This will also break on some drivers e.g. on mesa where they don't allow access to newer core versions than are explicitly enabled.

    You could also use the function pointer for vkGetPhysicalDeviceProperties2KHR if you enable VK_KHR_get_physical_device_properties2 when creating a 1.0 instance but in that case you should explicitly get a NULL function pointer back if you haven't enabled the extension.

    It seems the validation layers don't warn about this behaviour, I've filed an issue about it: https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/2067

    点赞 评论 复制链接分享
  • weixin_39639174 weixin_39639174 4月前

    Ah, thank you for the help! It was actually an accident of mine that I wasn't using VK_API_VERSION_1_2 during instance creation, so thanks for catching that too.

    点赞 评论 复制链接分享
  • weixin_39531688 weixin_39531688 4月前

    I can't follow the provided steps to reproduce because you haven't shared your application.

    It might be a good idea to attach a debugger to your program to see why it's exiting after launch. The log shows that it's getting as far as creating a vulkan instance before exiting. You can use the 'debugger delay' in the capture options to give you time to attach the debugger after the process starts.

    点赞 评论 复制链接分享
  • weixin_39639174 weixin_39639174 4月前

    I did as instructed, and it's crashing here:

    
    VkPhysicalDeviceProperties2 deviceProperties{};
    deviceProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
    vkGetPhysicalDeviceProperties2(device, &deviceProperties);
    

    with this error: Exception thrown at 0x0000000000000000 in gnometower.exe: 0xC0000005: Access violation executing location 0x0000000000000000.

    Any ideas?

    Also: it does not crash there when run independently, whether through the debugger or not. The device was obtained by vkEnumeratePhysicalDevices, and looks to be coherently created (the first call correctly gets a deviceCount of 1, the second call correctly fills out the array, etc...).

    点赞 评论 复制链接分享
  • weixin_39531688 weixin_39531688 4月前

    How are you obtaining the function pointer for vkGetPhysicalDeviceProperties2? Are you enabling the correct vulkan instance version or extensions to access it?

    Have you run your program with the validation layers to check that they don't identify any issues?

    点赞 评论 复制链接分享

相关推荐