mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d: Factor out vkd3d_create_thread().
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:
committed by
Alexandre Julliard
parent
843349c5e0
commit
bc5e8a9cc2
@@ -3112,7 +3112,6 @@ static HRESULT d3d12_device_init(struct d3d12_device *device,
|
||||
vkd3d_instance_incref(device->vkd3d_instance = instance);
|
||||
device->vk_info = instance->vk_info;
|
||||
device->signal_event = instance->signal_event;
|
||||
device->create_thread = instance->create_thread;
|
||||
device->join_thread = instance->join_thread;
|
||||
device->wchar_size = instance->wchar_size;
|
||||
|
||||
@@ -3198,6 +3197,32 @@ void d3d12_device_mark_as_removed(struct d3d12_device *device, HRESULT reason,
|
||||
device->removed_reason = reason;
|
||||
}
|
||||
|
||||
HRESULT vkd3d_create_thread(struct vkd3d_instance *instance,
|
||||
PFN_vkd3d_thread thread_main, void *data, union vkd3d_thread_handle *thread)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
int rc;
|
||||
|
||||
if (instance->create_thread)
|
||||
{
|
||||
if (!(thread->handle = instance->create_thread(thread_main, data)))
|
||||
{
|
||||
ERR("Failed to create thread.\n");
|
||||
hr = E_FAIL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((rc = pthread_create(&thread->pthread, NULL, thread_main, data)))
|
||||
{
|
||||
ERR("Failed to create thread, error %d.\n", rc);
|
||||
hr = hresult_from_errno(rc);
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
IUnknown *vkd3d_get_device_parent(ID3D12Device *device)
|
||||
{
|
||||
struct d3d12_device *d3d12_device = impl_from_ID3D12Device(device);
|
||||
|
||||
Reference in New Issue
Block a user