From 6babf112142edeb3a012af4d2c574a56115fbfad Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sat, 22 Oct 2016 21:11:42 +0200 Subject: [PATCH] libs/vkd3d: Export a function to get the Vulkan format from a DXGI format. --- include/vkd3d.h | 1 + libs/vkd3d/utils.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/include/vkd3d.h b/include/vkd3d.h index f2409a07..909ea8d8 100644 --- a/include/vkd3d.h +++ b/include/vkd3d.h @@ -45,6 +45,7 @@ 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, ID3D12Resource **resource); VkDevice vkd3d_get_vk_device(ID3D12Device *device); +VkFormat vkd3d_get_vk_format(DXGI_FORMAT format); VkInstance vkd3d_get_vk_instance(ID3D12Device *device); VkPhysicalDevice vkd3d_get_vk_physical_device(ID3D12Device *device); VkQueue vkd3d_get_vk_queue(ID3D12CommandQueue *queue); diff --git a/libs/vkd3d/utils.c b/libs/vkd3d/utils.c index d32dc396..fa1d6015 100644 --- a/libs/vkd3d/utils.c +++ b/libs/vkd3d/utils.c @@ -47,6 +47,16 @@ const struct vkd3d_format *vkd3d_get_format(DXGI_FORMAT dxgi_format) return NULL; } +VkFormat vkd3d_get_vk_format(DXGI_FORMAT format) +{ + const struct vkd3d_format *vkd3d_format; + + if (!(vkd3d_format = vkd3d_get_format(format))) + return VK_FORMAT_UNDEFINED; + + return vkd3d_format->vk_format; +} + bool vkd3d_array_reserve(void **elements, size_t *capacity, size_t element_count, size_t element_size) { size_t new_capacity, max_capacity;