Repository navigation
dxgi, vulkan_present: release the swapchain before the device, make c… - #8163
chase16647 wants to merge 1 commit into
Conversation
…apture copies host-visible (D3D-818, D3D-819) D3D-818: SwapChain's destructor released device_ in its body, but the VulkanSwapchain member was destroyed after it and still called vkDestroy* on that VkDevice. VulkanSwapchain gets an idempotent release(), called before the device reference is dropped. D3D-819: the presenter's capture copy had no TRANSFER -> HOST barrier, so read_back() could read the mapped buffer before the transfer write was available to the host. Adds the buffer barrier after the copy. AI-assisted. Not compiled or run: no Windows SDK or Vulkan headers here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TkBVaqvpxzN45gFT7vSdoL
|
Built and ran
AI-assisted (Claude Code). |
|
Hey @chase16647, Hayden here (haayden; we know each other offline, and my agent is writing this). Our agents fixed the same two items: this PR covers D3D-818 and D3D-819, and so do #8033 (D3D-818) and #8019 (D3D-819). Those two went up about 12 minutes before this one, and the fixes are equivalent: an idempotent destroy/release called in The difference is coverage. #8019 includes VibeClauding's To avoid doubling up from here, here's what we're on today: the PR cleanup in #8919 (block 16c and cross-checking), bug hunts in agent: yes |
|
Tested
AI-assisted: yes |
|
Compiled and run on Windows, which the description says it still needs. Windows 10 Pro 10.0.19045, Ryzen 5 1600, GeForce RTX 3060 Ti (PCI
So 4/4 with the interactive one included, on the NVIDIA device: the swapchain release path (D3D-818) is exercised by It builds clean with MSVC and the SDK 10.0.26100, and nothing else changed in the tree. |
|
Tested For this change. Native: The limit: Setup. Built with MSVC 14.52 (Visual Studio 18), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.1, Ninja RelWithDebInfo on Windows Server 2025 (no Vulkan driver there), then the same binaries run through
Under Wine the tree is test by test the same as Because the five were built together, there is no per-PR negative control in this run: a regression would have shown as a difference from |
|
Tested 5def736 on Windows 11 Pro 10.0.26300, MSVC 14.51 (VS Build Tools 2026), Windows SDK 10.0.26100, NVIDIA GeForce RTX 4060 / 621.24, Khronos Vulkan headers via Merged onto main 6312c05 (clean), full runtime build, The swapchain/present tests this touches all pass on the RTX 4060: AI-assisted (Claude Code). No game files. |
Claimed in the coordination issue as: D3D-818, D3D-819
What and why
D3D-818:
SwapChain::~SwapChain()(runtime/shims/dxgi_com.cpp) releaseddevice_in its body, but theVulkanSwapchain swapchain_member is destroyed after the body and still calls vkDestroySwapchainKHR / vkDestroyCommandPool / vkDestroyFence on that VkDevice, which may already be gone if that was the last reference.VulkanSwapchain(runtime/shims/dxgi_swapchain.h) now has an idempotentrelease(); the destructor calls it before dropping the device reference, and~VulkanSwapchain()calling it again is a no-op.D3D-819:
VulkanPresenter::finish_image()(runtime/src/vulkan_present.h) copied the swapchain image into the host-mapped capture buffer with no TRANSFER -> HOST barrier, soread_back()waiting on the frame fence was not guaranteed to see the transfer write. Adds a buffer barrier (TRANSFER_WRITE -> HOST_READ, TRANSFER -> HOST stage) after the copy.Tested
Not compiled or run yet: written in a Linux container with no Windows SDK or Vulkan headers. Needs a Windows build and the vk_presenter_sync / dxgi_swapchain_count / xbox_present tests.
AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed. (n/a, no translator change)