=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: winex11: Simplify X11DRV_vkEnumerateInstanceExtensionProperties().
Alexandre Julliard
julliard at winehq.org
Fri Mar 23 19:17:05 CDT 2018
Module: wine
Branch: master
Commit: eefc444f9f00b70eb0f26fd6499e5b45997ba0fd
URL: https://source.winehq.org/git/wine.git/?a=commit;h=eefc444f9f00b70eb0f26fd6499e5b45997ba0fd
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Fri Mar 23 14:46:18 2018 +0100
winex11: Simplify X11DRV_vkEnumerateInstanceExtensionProperties().
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 f96ef64..68fb339 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)
More information about the wine-cvs
mailing list