Commit 32eef26a authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

winevulkan: Simplify wine_vkEnumeratePhysicalDevices().

parent 76275505
...@@ -838,42 +838,27 @@ static VkResult WINAPI wine_vkEnumerateInstanceExtensionProperties(const char *l ...@@ -838,42 +838,27 @@ static VkResult WINAPI wine_vkEnumerateInstanceExtensionProperties(const char *l
return res; return res;
} }
VkResult WINAPI wine_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *device_count, VkResult WINAPI wine_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *count,
VkPhysicalDevice *devices) VkPhysicalDevice *devices)
{ {
VkResult res; unsigned int i;
unsigned int i, num_copies;
TRACE("%p %p %p\n", instance, device_count, devices); TRACE("%p %p %p\n", instance, count, devices);
if (!devices) if (!devices)
{ {
*device_count = instance->num_phys_devs; *count = instance->num_phys_devs;
return VK_SUCCESS; return VK_SUCCESS;
} }
if (*device_count < instance->num_phys_devs) *count = min(*count, instance->num_phys_devs);
{ for (i = 0; i < *count; i++)
/* 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++)
{ {
devices[i] = instance->phys_devs[i]; devices[i] = instance->phys_devs[i];
} }
*device_count = num_copies;
TRACE("Returning %u devices\n", *device_count); TRACE("Returning %u devices.\n", *count);
return res; return *count < instance->num_phys_devs ? VK_INCOMPLETE : VK_SUCCESS;
} }
void WINAPI wine_vkFreeCommandBuffers(VkDevice device, VkCommandPool pool, uint32_t count, void WINAPI wine_vkFreeCommandBuffers(VkDevice device, VkCommandPool pool, uint32_t count,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment