mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 00:00:11 +01:00
vulkan/wsi: Add wsi_common_is_swapchain_image() helper
Add a helper function to check if a VkImageCreateInfo represents a swapchain image by looking for VkImageSwapchainCreateInfoKHR in the pNext chain. This consolidates the swapchain detection logic that is currently duplicated across all Vulkan drivers, and handles the Android case in one place. Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Suggested-by: Faith Ekstrand <faith.ekstrand@collabora.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38541>
This commit is contained in:
parent
840c80d80e
commit
9a89280d62
1 changed files with 13 additions and 0 deletions
|
|
@ -30,6 +30,7 @@
|
|||
#include "vk_alloc.h"
|
||||
#include "vk_dispatch_table.h"
|
||||
#include "vk_internal_exts.h"
|
||||
#include "vk_util.h"
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <vulkan/vk_icd.h>
|
||||
|
||||
|
|
@ -293,6 +294,18 @@ wsi_common_queue_present(const struct wsi_device *wsi,
|
|||
struct vk_queue *queue,
|
||||
const VkPresentInfoKHR *pPresentInfo);
|
||||
|
||||
static inline bool
|
||||
wsi_common_is_swapchain_image(const VkImageCreateInfo *pCreateInfo)
|
||||
{
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
return false;
|
||||
# else
|
||||
const VkImageSwapchainCreateInfoKHR *swapchain_info =
|
||||
vk_find_struct_const(pCreateInfo->pNext, IMAGE_SWAPCHAIN_CREATE_INFO_KHR);
|
||||
return swapchain_info && swapchain_info->swapchain != VK_NULL_HANDLE;
|
||||
#endif
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_common_create_swapchain_image(const struct wsi_device *wsi,
|
||||
const VkImageCreateInfo *pCreateInfo,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue