From 88835021219b6363d516bb59cd3230d9ead0fe52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Wed, 17 Jan 2018 12:48:09 +0100 Subject: [PATCH] libs/vkd3d: Introduce function to get Vulkan instance from vkd3d instance. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- demos/demo_xcb.h | 2 +- include/vkd3d.h | 3 ++- libs/vkd3d/device.c | 20 ++++++++++++-------- libs/vkd3d/vkd3d.map | 1 + 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/demos/demo_xcb.h b/demos/demo_xcb.h index a683dcae..ca0887c3 100644 --- a/demos/demo_xcb.h +++ b/demos/demo_xcb.h @@ -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); diff --git a/include/vkd3d.h b/include/vkd3d.h index 78d5e2e4..6017e1ac 100644 --- a/include/vkd3d.h +++ b/include/vkd3d.h @@ -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); diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index d84c5796..3255dd6e 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -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; +} diff --git a/libs/vkd3d/vkd3d.map b/libs/vkd3d/vkd3d.map index 6f408410..c5157c61 100644 --- a/libs/vkd3d/vkd3d.map +++ b/libs/vkd3d/vkd3d.map @@ -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;