[PATCH 5/6] winex11: Simplify X11DRV_vkEnumerateInstanceExtensionProperties().
Józef Kucia
jkucia at codeweavers.com
Fri Mar 23 08:46:18 CDT 2018
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
Also, remove outdated comment.
---
dlls/winex11.drv/vulkan.c | 32 ++++++--------------------------
1 file changed, 6 insertions(+), 26 deletions(-)
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
index f96ef6413761..68fb339adcc5 100644
--- a/dlls/winex11.drv/vulkan.c
+++ b/dlls/winex11.drv/vulkan.c
@@ -368,8 +368,7 @@ static void X11DRV_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapcha
static VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *layer_name,
uint32_t *count, VkExtensionProperties* properties)
{
- VkResult res;
- unsigned int i, num_copies;
+ unsigned int i;
TRACE("layer_name %p, count %p, properties %p\n", debugstr_a(layer_name), count, properties);
@@ -382,37 +381,18 @@ static VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *layer_
if (!properties)
{
- /* When properties is NULL, we need to return the number of extensions
- * supported. For now report 0 until we add some e.g.
- * VK_KHR_win32_surface. Long-term this needs to be an intersection
- * between what the native library supports and what thunks we have.
- */
*count = winex11_vk_instance_extensions_count;
return VK_SUCCESS;
}
- if (*count < winex11_vk_instance_extensions_count)
- {
- /* Incomplete is a type of success used to signal the application
- * that not all devices got copied.
- */
- num_copies = *count;
- res = VK_INCOMPLETE;
- }
- else
- {
- num_copies = winex11_vk_instance_extensions_count;
- res = VK_SUCCESS;
- }
-
- for (i = 0; i < num_copies; i++)
+ *count = min(*count, winex11_vk_instance_extensions_count);
+ for (i = 0; i < *count; i++)
{
- memcpy(&properties[i], &winex11_vk_instance_extensions[i], sizeof(*properties));
+ properties[i] = winex11_vk_instance_extensions[i];
}
- *count = num_copies;
- TRACE("Result %d, extensions copied %u\n", res, num_copies);
- return res;
+ TRACE("Returning %u extensions.\n", *count);
+ return *count < winex11_vk_instance_extensions_count ? VK_INCOMPLETE : VK_SUCCESS;
}
static void * X11DRV_vkGetDeviceProcAddr(VkDevice device, const char *name)
--
2.16.1
More information about the wine-devel
mailing list