diff options
author | Eduardo Lima Mitev <[email protected]> | 2016-10-28 14:45:36 +0200 |
---|---|---|
committer | Eduardo Lima Mitev <[email protected]> | 2016-10-28 16:53:28 +0200 |
commit | 129da274261b6e79f459e24428591f137bf92ed1 (patch) | |
tree | 418c111128147042650e7384f43d82f1f95a8e71 /src | |
parent | b677b99db5c48ffd1eeef538b962080ac5fd65d9 (diff) |
vulkan/wsi/x11: Smplify implementation of vkGetPhysicalDeviceSurfaceFormatsKHR
This patch simplifies x11_surface_get_formats(). It is actually just a
readability improvement over the patch I provided earlier this week
(750d8cad72).
Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/vulkan/wsi/wsi_common_x11.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 4a232f5213b..814284799f6 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -396,16 +396,11 @@ x11_surface_get_formats(VkIcdSurfaceBase *surface, return VK_SUCCESS; } - VkResult result = VK_SUCCESS; - - if (*pSurfaceFormatCount > ARRAY_SIZE(formats)) - *pSurfaceFormatCount = ARRAY_SIZE(formats); - else if (*pSurfaceFormatCount < ARRAY_SIZE(formats)) - result = VK_INCOMPLETE; - + *pSurfaceFormatCount = MIN2(*pSurfaceFormatCount, ARRAY_SIZE(formats)); typed_memcpy(pSurfaceFormats, formats, *pSurfaceFormatCount); - return result; + return *pSurfaceFormatCount < ARRAY_SIZE(formats) ? + VK_INCOMPLETE : VK_SUCCESS; } static VkResult |