From 648a1682191ca0ec22902b7cacd7bc1c3e5a7781 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 25 Aug 2023 17:01:46 +0100 Subject: [PATCH] a/vk: Even more flag bits string functions --- src/xrt/auxiliary/vk/vk_helpers.c | 21 +++++++++++++++++++++ src/xrt/auxiliary/vk/vk_helpers.h | 9 +++++++++ 2 files changed, 30 insertions(+) diff --git a/src/xrt/auxiliary/vk/vk_helpers.c b/src/xrt/auxiliary/vk/vk_helpers.c index e38c58747..e85f493ab 100644 --- a/src/xrt/auxiliary/vk/vk_helpers.c +++ b/src/xrt/auxiliary/vk/vk_helpers.c @@ -598,6 +598,27 @@ vk_surface_transform_flag_string(VkSurfaceTransformFlagBitsKHR bits, bool null_o } } +#ifdef VK_KHR_display +XRT_CHECK_RESULT const char * +vk_display_plane_alpha_flag_string(VkDisplayPlaneAlphaFlagBitsKHR bits, bool null_on_unknown) +{ + switch (bits) { + ENUM_TO_STR(VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR); + ENUM_TO_STR(VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR); + ENUM_TO_STR(VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR); + ENUM_TO_STR(VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR); + default: + if (bits == 0) { + return "DISPLAY PLANE ALPHA: NO BITS SET"; + } else if (bits & (bits - 1)) { + return "DISPLAY PLANE ALPHA: MULTIPLE BITS SET"; + } else { + return null_on_unknown ? NULL : "DISPLAY PLANE ALPHA: UNKNOWN BIT"; + } + } +} +#endif + XRT_CHECK_RESULT const char * xrt_swapchain_usage_flag_string(enum xrt_swapchain_usage_bits bits, bool null_on_unknown) { diff --git a/src/xrt/auxiliary/vk/vk_helpers.h b/src/xrt/auxiliary/vk/vk_helpers.h index feb8f2f33..cb4965bf0 100644 --- a/src/xrt/auxiliary/vk/vk_helpers.h +++ b/src/xrt/auxiliary/vk/vk_helpers.h @@ -496,6 +496,15 @@ vk_composite_alpha_flag_string(VkCompositeAlphaFlagBitsKHR bits, bool null_on_un XRT_CHECK_RESULT const char * vk_surface_transform_flag_string(VkSurfaceTransformFlagBitsKHR bits, bool null_on_unknown); +#ifdef VK_KHR_display +/*! + * Returns the display plane alpha flag if one valid bit is set, + * if multiple bits are set, will return 'MULTIPLE BIT SET'. + */ +XRT_CHECK_RESULT const char * +vk_display_plane_alpha_flag_string(VkDisplayPlaneAlphaFlagBitsKHR bits, bool null_on_unknown); +#endif + /*! * Returns xrt swapchain_usage flag if one valid bit is set, * if multiple bits are set, will return 'MULTIPLE BIT SET'.