Skip to content

Commit

Permalink
vkd3d: Release swapchain command queue reference after swapchain decref
Browse files Browse the repository at this point in the history
This prevents possibly destroying the d3d12 device while releasing the
frame_latency_fence if the device ref count hits zero.
  • Loading branch information
esullivan-nvidia authored and HansKristian-Work committed May 6, 2024
1 parent c0f2c85 commit ff75ae5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libs/vkd3d/swapchain.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ static ULONG STDMETHODCALLTYPE dxgi_vk_swap_chain_Release(IDXGIVkSwapChain *ifac
{
struct dxgi_vk_swap_chain *chain = impl_from_IDXGIVkSwapChain(iface);
struct d3d12_device *device = chain->queue->device;
struct d3d12_command_queue *queue = chain->queue;
UINT refcount;

refcount = InterlockedDecrement(&chain->refcount);
Expand All @@ -479,8 +480,8 @@ static ULONG STDMETHODCALLTYPE dxgi_vk_swap_chain_Release(IDXGIVkSwapChain *ifac
if (device->vk_info.NV_low_latency2)
d3d12_device_remove_swapchain(device, chain);

ID3D12CommandQueue_Release(&chain->queue->ID3D12CommandQueue_iface);
dxgi_vk_swap_chain_decref(chain);
ID3D12CommandQueue_Release(&queue->ID3D12CommandQueue_iface);
}

return refcount;
Expand Down

0 comments on commit ff75ae5

Please sign in to comment.