libs/vkd3d: Introduce function to get Vulkan instance from vkd3d instance.

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:
Józef Kucia 2018-01-17 12:48:09 +01:00 committed by Alexandre Julliard
parent b0aa4ed434
commit 8883502121
4 changed files with 16 additions and 10 deletions

View File

@ -344,7 +344,7 @@ static inline struct demo_swapchain *demo_swapchain_create(ID3D12CommandQueue *c
if (FAILED(ID3D12CommandQueue_GetDevice(command_queue, &IID_ID3D12Device, (void **)&d3d12_device)))
return NULL;
vk_instance = vkd3d_get_vk_instance(d3d12_device);
vk_instance = vkd3d_get_vk_instance(vkd3d_instance_from_device(d3d12_device));
vk_physical_device = vkd3d_get_vk_physical_device(d3d12_device);
vk_device = vkd3d_get_vk_device(d3d12_device);

View File

@ -67,6 +67,7 @@ struct vkd3d_device_create_info
HRESULT vkd3d_create_instance(const struct vkd3d_instance_create_info *create_info,
struct vkd3d_instance **instance);
VkInstance vkd3d_get_vk_instance(struct vkd3d_instance *instance);
ULONG vkd3d_instance_decref(struct vkd3d_instance *instance);
ULONG vkd3d_instance_incref(struct vkd3d_instance *instance);
@ -75,8 +76,8 @@ HRESULT vkd3d_create_device(const struct vkd3d_device_create_info *create_info,
HRESULT vkd3d_create_image_resource(ID3D12Device *device, const D3D12_RESOURCE_DESC *desc,
VkImage vk_image, unsigned int resource_flags, ID3D12Resource **resource);
VkDevice vkd3d_get_vk_device(ID3D12Device *device);
VkInstance vkd3d_get_vk_instance(ID3D12Device *device);
VkPhysicalDevice vkd3d_get_vk_physical_device(ID3D12Device *device);
struct vkd3d_instance *vkd3d_instance_from_device(ID3D12Device *device);
uint32_t vkd3d_get_vk_queue_family_index(ID3D12CommandQueue *queue);
VkQueue vkd3d_acquire_vk_queue(ID3D12CommandQueue *queue);

View File

@ -289,6 +289,11 @@ ULONG vkd3d_instance_decref(struct vkd3d_instance *instance)
return refcount;
}
VkInstance vkd3d_get_vk_instance(struct vkd3d_instance *instance)
{
return instance->vk_instance;
}
static void vkd3d_trace_physical_device(VkPhysicalDevice device,
const struct vkd3d_vk_instance_procs *vk_procs)
{
@ -2076,17 +2081,16 @@ VkDevice vkd3d_get_vk_device(ID3D12Device *device)
return d3d12_device->vk_device;
}
VkInstance vkd3d_get_vk_instance(ID3D12Device *device)
{
struct d3d12_device *d3d12_device = impl_from_ID3D12Device(device);
struct vkd3d_instance *instance = d3d12_device->vkd3d_instance;
return instance->vk_instance;
}
VkPhysicalDevice vkd3d_get_vk_physical_device(ID3D12Device *device)
{
struct d3d12_device *d3d12_device = impl_from_ID3D12Device(device);
return d3d12_device->vk_physical_device;
}
struct vkd3d_instance *vkd3d_instance_from_device(ID3D12Device *device)
{
struct d3d12_device *d3d12_device = impl_from_ID3D12Device(device);
return d3d12_device->vkd3d_instance;
}

View File

@ -12,6 +12,7 @@ global:
vkd3d_get_vk_physical_device;
vkd3d_get_vk_queue_family_index;
vkd3d_instance_decref;
vkd3d_instance_from_device;
vkd3d_instance_incref;
vkd3d_release_vk_queue;
vkd3d_serialize_root_signature;