dzn: Hook-up device-lost detection
Provide a vk_device::check_status() implementation so the code can call it at key moments to detect when a device-lost event (device-removed in D3D12) has been received. Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17249>
This commit is contained in:
parent
6a491d1628
commit
0371b1707b
|
@ -1898,6 +1898,17 @@ dzn_device_destroy(struct dzn_device *device, const VkAllocationCallbacks *pAllo
|
|||
vk_free2(&instance->vk.alloc, pAllocator, device);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
dzn_device_check_status(struct vk_device *dev)
|
||||
{
|
||||
struct dzn_device *device = container_of(dev, struct dzn_device, vk);
|
||||
|
||||
if (FAILED(ID3D12Device_GetDeviceRemovedReason(device->dev)))
|
||||
return vk_device_set_lost(&device->vk, "D3D12 device removed");
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
dzn_device_create(struct dzn_physical_device *pdev,
|
||||
const VkDeviceCreateInfo *pCreateInfo,
|
||||
|
@ -1954,6 +1965,7 @@ dzn_device_create(struct dzn_physical_device *pdev,
|
|||
device->vk.ref_pipeline_layout = dzn_device_ref_pipeline_layout;
|
||||
device->vk.unref_pipeline_layout = dzn_device_unref_pipeline_layout;
|
||||
device->vk.create_sync_for_memory = dzn_device_create_sync_for_memory;
|
||||
device->vk.check_status = dzn_device_check_status;
|
||||
|
||||
device->dev = dzn_physical_device_get_d3d12_dev(pdev);
|
||||
if (!device->dev) {
|
||||
|
|
Loading…
Reference in New Issue