libs/vkd3d: Pass signal event function pointer to vkd3d_create_device().

This commit is contained in:
Józef Kucia 2016-10-07 13:26:39 +02:00
parent 544c2668ca
commit ef6a3d78a2
5 changed files with 17 additions and 7 deletions

View File

@ -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,

View File

@ -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
{

View File

@ -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;

View File

@ -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);
}

View File

@ -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;