mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Simplify d3d12_device_init().
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f3e48a9192
commit
e7eb9ca936
@ -2282,6 +2282,7 @@ struct d3d12_device *unsafe_impl_from_ID3D12Device(ID3D12Device *iface)
|
|||||||
static HRESULT d3d12_device_init(struct d3d12_device *device,
|
static HRESULT d3d12_device_init(struct d3d12_device *device,
|
||||||
struct vkd3d_instance *instance, const struct vkd3d_device_create_info *create_info)
|
struct vkd3d_instance *instance, const struct vkd3d_device_create_info *create_info)
|
||||||
{
|
{
|
||||||
|
const struct vkd3d_vk_device_procs *vk_procs;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
device->ID3D12Device_iface.lpVtbl = &d3d12_device_vtbl;
|
device->ID3D12Device_iface.lpVtbl = &d3d12_device_vtbl;
|
||||||
@ -2295,30 +2296,22 @@ static HRESULT d3d12_device_init(struct d3d12_device *device,
|
|||||||
device->wchar_size = instance->wchar_size;
|
device->wchar_size = instance->wchar_size;
|
||||||
|
|
||||||
device->adapter_luid = create_info->adapter_luid;
|
device->adapter_luid = create_info->adapter_luid;
|
||||||
|
device->removed_reason = S_OK;
|
||||||
|
|
||||||
|
device->vk_device = VK_NULL_HANDLE;
|
||||||
|
device->vk_dummy_sampler = VK_NULL_HANDLE;
|
||||||
|
|
||||||
if (FAILED(hr = vkd3d_create_vk_device(device, create_info)))
|
if (FAILED(hr = vkd3d_create_vk_device(device, create_info)))
|
||||||
{
|
goto out_free_instance;
|
||||||
vkd3d_instance_decref(device->vkd3d_instance);
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FAILED(hr = d3d12_device_create_dummy_sampler(device)))
|
if (FAILED(hr = d3d12_device_create_dummy_sampler(device)))
|
||||||
{
|
{
|
||||||
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
|
|
||||||
ERR("Failed to create dummy sampler, hr %#x.\n", hr);
|
ERR("Failed to create dummy sampler, hr %#x.\n", hr);
|
||||||
VK_CALL(vkDestroyDevice(device->vk_device, NULL));
|
goto out_free_vk_resources;
|
||||||
vkd3d_instance_decref(device->vkd3d_instance);
|
|
||||||
return hr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(hr = vkd3d_fence_worker_start(&device->fence_worker, device)))
|
if (FAILED(hr = vkd3d_fence_worker_start(&device->fence_worker, device)))
|
||||||
{
|
goto out_free_vk_resources;
|
||||||
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
|
|
||||||
VK_CALL(vkDestroySampler(device->vk_device, device->vk_dummy_sampler, NULL));
|
|
||||||
VK_CALL(vkDestroyDevice(device->vk_device, NULL));
|
|
||||||
vkd3d_instance_decref(device->vkd3d_instance);
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
vkd3d_gpu_va_allocator_init(&device->gpu_va_allocator);
|
vkd3d_gpu_va_allocator_init(&device->gpu_va_allocator);
|
||||||
|
|
||||||
@ -2327,9 +2320,15 @@ static HRESULT d3d12_device_init(struct d3d12_device *device,
|
|||||||
if ((device->parent = create_info->parent))
|
if ((device->parent = create_info->parent))
|
||||||
IUnknown_AddRef(device->parent);
|
IUnknown_AddRef(device->parent);
|
||||||
|
|
||||||
device->removed_reason = S_OK;
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
|
out_free_vk_resources:
|
||||||
|
vk_procs = &device->vk_procs;
|
||||||
|
VK_CALL(vkDestroySampler(device->vk_device, device->vk_dummy_sampler, NULL));
|
||||||
|
VK_CALL(vkDestroyDevice(device->vk_device, NULL));
|
||||||
|
out_free_instance:
|
||||||
|
vkd3d_instance_decref(device->vkd3d_instance);
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT d3d12_device_create(struct vkd3d_instance *instance,
|
HRESULT d3d12_device_create(struct vkd3d_instance *instance,
|
||||||
|
Loading…
Reference in New Issue
Block a user