diff --git a/include/vkd3d.h b/include/vkd3d.h index dbcf4fa1..945fdf09 100644 --- a/include/vkd3d.h +++ b/include/vkd3d.h @@ -30,9 +30,12 @@ extern "C" { #endif /* __cplusplus */ +typedef BOOL (WINAPI *vkd3d_signal_event_pfn)(HANDLE event); + struct vkd3d_device_create_info { D3D_FEATURE_LEVEL minimum_feature_level; + vkd3d_signal_event_pfn signal_event_pfn; }; HRESULT WINAPI vkd3d_create_device(const struct vkd3d_device_create_info *create_info, diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index af099f43..cac89500 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -162,7 +162,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_fence_SetEventOnCompletion(ID3D12Fence *i if (value <= fence->value) { - VKD3DSignalEvent(event); + fence->device->signal_event(event); pthread_mutex_unlock(&fence->mutex); return S_OK; } @@ -217,7 +217,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_fence_Signal(ID3D12Fence *iface, UINT64 v if (current->value <= value) { - VKD3DSignalEvent(current->event); + fence->device->signal_event(current->event); } else { diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 74a43591..f78ae2b4 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -1071,7 +1071,8 @@ static const struct ID3D12DeviceVtbl d3d12_device_vtbl = d3d12_device_GetAdapterLuid, }; -static HRESULT d3d12_device_init(struct d3d12_device *device) +static HRESULT d3d12_device_init(struct d3d12_device *device, + const struct vkd3d_device_create_info *create_info) { HRESULT hr; @@ -1087,10 +1088,13 @@ static HRESULT d3d12_device_init(struct d3d12_device *device) return hr; } + device->signal_event = create_info->signal_event_pfn; + return S_OK; } -HRESULT d3d12_device_create(struct d3d12_device **device) +HRESULT d3d12_device_create(const struct vkd3d_device_create_info *create_info, + struct d3d12_device **device) { struct d3d12_device *object; HRESULT hr; @@ -1098,7 +1102,7 @@ HRESULT d3d12_device_create(struct d3d12_device **device) if (!(object = vkd3d_malloc(sizeof(*object)))) return E_OUTOFMEMORY; - if (FAILED(hr = d3d12_device_init(object))) + if (FAILED(hr = d3d12_device_init(object, create_info))) { vkd3d_free(object); return hr; diff --git a/libs/vkd3d/vkd3d_main.c b/libs/vkd3d/vkd3d_main.c index 8acab96e..04164ee9 100644 --- a/libs/vkd3d/vkd3d_main.c +++ b/libs/vkd3d/vkd3d_main.c @@ -44,7 +44,7 @@ HRESULT WINAPI vkd3d_create_device(const struct vkd3d_device_create_info *create return E_INVALIDARG; } - if (FAILED(hr = d3d12_device_create(&object))) + if (FAILED(hr = d3d12_device_create(create_info, &object))) return hr; return return_interface((IUnknown *)&object->ID3D12Device_iface, &IID_ID3D12Device, @@ -63,6 +63,7 @@ HRESULT WINAPI D3D12CreateDevice(IUnknown *adapter, D3D_FEATURE_LEVEL minimum_fe FIXME("Ignoring adapter %p.\n", adapter); create_info.minimum_feature_level = minimum_feature_level; + create_info.signal_event_pfn = VKD3DSignalEvent; return vkd3d_create_device(&create_info, riid, device); } diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 11c36975..d0ffb821 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -246,6 +246,7 @@ struct d3d12_device VkDevice vk_device; struct vkd3d_vk_device_procs vk_procs; + vkd3d_signal_event_pfn signal_event; unsigned int direct_queue_family_index; unsigned int copy_queue_family_index; @@ -254,7 +255,8 @@ struct d3d12_device struct vkd3d_instance vkd3d_instance; }; -HRESULT d3d12_device_create(struct d3d12_device **device) DECLSPEC_HIDDEN; +HRESULT d3d12_device_create(const struct vkd3d_device_create_info *create_info, + struct d3d12_device **device) DECLSPEC_HIDDEN; /* utils */ BOOL is_valid_feature_level(D3D_FEATURE_LEVEL feature_level) DECLSPEC_HIDDEN;