Repository navigation
dxgi, vulkan_present: release the swapchain before the device, make c… - #8163
Open
chase16647 wants to merge 1 commit into
Open
chase16647 wants to merge 1 commit into
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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)