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

winex11: Simplify X11DRV_vkEnumerateInstanceExtensionProperties().

parent 78447f8d
...@@ -368,8 +368,7 @@ static void X11DRV_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapcha ...@@ -368,8 +368,7 @@ static void X11DRV_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapcha
static VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *layer_name, static VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *layer_name,
uint32_t *count, VkExtensionProperties* properties) uint32_t *count, VkExtensionProperties* properties)
{ {
VkResult res; unsigned int i;
unsigned int i, num_copies;
TRACE("layer_name %p, count %p, properties %p\n", debugstr_a(layer_name), count, properties); 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_ ...@@ -382,37 +381,18 @@ static VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *layer_
if (!properties) 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; *count = winex11_vk_instance_extensions_count;
return VK_SUCCESS; return VK_SUCCESS;
} }
if (*count < winex11_vk_instance_extensions_count) *count = min(*count, winex11_vk_instance_extensions_count);
{ 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 = *count;
res = VK_INCOMPLETE;
}
else
{
num_copies = winex11_vk_instance_extensions_count;
res = VK_SUCCESS;
}
for (i = 0; i < num_copies; 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); TRACE("Returning %u extensions.\n", *count);
return res; return *count < winex11_vk_instance_extensions_count ? VK_INCOMPLETE : VK_SUCCESS;
} }
static void * X11DRV_vkGetDeviceProcAddr(VkDevice device, const char *name) static void * X11DRV_vkGetDeviceProcAddr(VkDevice device, const char *name)
......
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