.. _program_listing_file_Src_GraphicsEngineVulkan_common_FormatHelper.hpp: Program Listing for File FormatHelper.hpp ========================================= |exhale_lsh| :ref:`Return to documentation for file ` (``Src/GraphicsEngineVulkan/common/FormatHelper.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include #include #include #include "spdlog/spdlog.h" namespace Kataglyphis { static VkFormat choose_supported_format(VkPhysicalDevice physical_device, const std::vector &formats, VkImageTiling tiling, VkFormatFeatureFlags feature_flags) { // loop through options and find compatible one for (VkFormat format : formats) { // get properties for give format on this device VkFormatProperties properties; vkGetPhysicalDeviceFormatProperties(physical_device, format, &properties); // depending on tiling choice, need to check for different bit flag if (tiling == VK_IMAGE_TILING_LINEAR && (properties.linearTilingFeatures & feature_flags) == feature_flags) { return format; } else if (tiling == VK_IMAGE_TILING_OPTIMAL && (properties.optimalTilingFeatures & feature_flags) == feature_flags) { return format; } } spdlog::error("Failed to find supported format!"); } }// namespace Kataglyphis