From 32eef26a7dbbd755d20494454e3b657c48ba1bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Thu, 15 Mar 2018 10:26:33 +0100 Subject: [PATCH] winevulkan: Simplify wine_vkEnumeratePhysicalDevices(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Alexandre Julliard --- dlls/winevulkan/vulkan.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 5062701e61d..b9326baef6a 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -838,42 +838,27 @@ static VkResult WINAPI wine_vkEnumerateInstanceExtensionProperties(const char *l return res; } -VkResult WINAPI wine_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *device_count, +VkResult WINAPI wine_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *count, VkPhysicalDevice *devices) { - VkResult res; - unsigned int i, num_copies; + unsigned int i; - TRACE("%p %p %p\n", instance, device_count, devices); + TRACE("%p %p %p\n", instance, count, devices); if (!devices) { - *device_count = instance->num_phys_devs; + *count = instance->num_phys_devs; return VK_SUCCESS; } - if (*device_count < instance->num_phys_devs) - { - /* Incomplete is a type of success used to signal the application - * that not all devices got copied. - */ - num_copies = *device_count; - res = VK_INCOMPLETE; - } - else - { - num_copies = instance->num_phys_devs; - res = VK_SUCCESS; - } - - for (i = 0; i < num_copies; i++) + *count = min(*count, instance->num_phys_devs); + for (i = 0; i < *count; i++) { devices[i] = instance->phys_devs[i]; } - *device_count = num_copies; - TRACE("Returning %u devices\n", *device_count); - return res; + TRACE("Returning %u devices.\n", *count); + return *count < instance->num_phys_devs ? VK_INCOMPLETE : VK_SUCCESS; } void WINAPI wine_vkFreeCommandBuffers(VkDevice device, VkCommandPool pool, uint32_t count,