LunarG / gfxreconstruct

Graphics API Capture and Replay Tools for Reconstructing Graphics Application Behavior
https://vulkan.lunarg.com/doc/sdk/latest/linux/capture_tools.html
MIT License
390 stars 108 forks source link

Replay of trimmed proton applications crashes, untrimmed replays work #921

Open kkartaltepe opened 1 year ago

kkartaltepe commented 1 year ago

Im not sure if this related to #631 but it sounds similar. Attempting to use hotkeys to create a trimmed capture will fail to replay with gfxrecon-replay. Capturing the same program from launch results in a replay that can be played back successfully.

GFXRECON_LOG_LEVEL=debug doesnt seem to mention anything of note when capturing via a hotkey trigger.

The specific failure is a segfault after [gfxrecon] WARNING - Failed to map handle for object id 2523

The specific app in this case was Hades (directx backend) on steam with proton Experimental 20221129 and gfxreconstruct compiled at 2a2c74f9 on an A750 running mesa compiled at d41d8cd9. I can provide the traces if they matter but I'm not sure where I can dump 1GB files.

kkartaltepe commented 1 year ago

The stack trace with debug symbols looks like

#0  0x00007ffff6bdbdb3 in vk_common_WaitForFences () from /usr/lib/libvulkan_intel.so
#1  0x00005555555e4f98 in gfxrecon::decode::VulkanReplayConsumerBase::OverrideWaitForFences(VkResult (*)(VkDevice_T*, unsigned int, VkFence_T* const*, unsigned int, unsigned long), VkResult, gfxrecon::decode::DeviceInfo const*, unsigned int, gfxrecon::decode::HandlePointerDecoder<VkFence_T*> const*, unsigned int, unsigned long) ()
#2  0x00005555556d266f in gfxrecon::decode::VulkanReplayConsumer::Process_vkWaitForFences(gfxrecon::decode::ApiCallInfo const&, VkResult, unsigned long, unsigned int, gfxrecon::decode::HandlePointerDecoder<VkFence_T*>*, unsigned int, unsigned long) ()
#3  0x000055555564a6ff in gfxrecon::decode::VulkanDecoder::Decode_vkWaitForFences(gfxrecon::decode::ApiCallInfo const&, unsigned char const*, unsigned long)
    ()
#4  0x00005555555b71a0 in gfxrecon::decode::FileProcessor::ProcessFunctionCall(gfxrecon::format::BlockHeader const&, gfxrecon::format::ApiCallId) ()
#5  0x00005555555b9871 in gfxrecon::decode::FileProcessor::ProcessBlocks() ()
#6  0x00005555555aed0c in gfxrecon::application::Application::PlaySingleFrame() ()
#7  0x00005555555aeead in gfxrecon::application::Application::Run() ()
#8  0x00005555555a9611 in main ()

And validation suggests the call isnt kosher so I presume its not a driver bug in this case:

UNASSIGNED-GeneralParameterError-RequiredParameter(ERROR / SPEC): msgNum: -1711571459 - Validation Error: [ UNASSIGNED-GeneralParameterError-RequiredParameter ] Object 0: handle = 0x555556416a60, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x99fb7dfd | vkWaitForFences: required parameter pFences[0] specified as VK_NULL_HANDLE
    Objects: 1
        [0] 0x555556416a60, type: 3, name: NULL
VUID-vkWaitForFences-pFences-parameter(ERROR / SPEC): msgNum: 1181211260 - Validation Error: [ VUID-vkWaitForFences-pFences-parameter ] Object 0: handle = 0x555555c1fa30, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x4667da7c | Invalid VkFence Object 0x0. The Vulkan spec states: pFences must be a valid pointer to an array of fenceCount valid VkFence handles (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkWaitForFences-pFences-parameter)
    Objects: 1
        [0] 0x555555c1fa30, type: 1, name: NULL
ishitatsuyuki commented 1 year ago

If you're running vkd3d it's almost certainly #909. Since it still lacks a proper fix, you can try my quick hack here.

kkartaltepe commented 1 year ago

I can confirm your hack results in a playable trimmed replay. Also the backend in this case was dxvk not vkd3d.

Also checking #910 as it reportedly fixes your issue it appears to also produce a playable replay.