| 84 | VkFormat get_suitable_depth_format(VkPhysicalDevice physical_device, |
| 85 | bool depth_only, |
| 86 | const std::vector<VkFormat> &depth_format_priority_list) |
| 87 | { |
| 88 | VkFormat depth_format{VK_FORMAT_UNDEFINED}; |
| 89 | |
| 90 | for (auto &format : depth_format_priority_list) |
| 91 | { |
| 92 | if (depth_only && !is_depth_only_format(format)) |
| 93 | { |
| 94 | continue; |
| 95 | } |
| 96 | |
| 97 | VkFormatProperties properties; |
| 98 | vkGetPhysicalDeviceFormatProperties(physical_device, format, &properties); |
| 99 | |
| 100 | // Format must support depth stencil attachment for optimal tiling |
| 101 | if (properties.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) |
| 102 | { |
| 103 | depth_format = format; |
| 104 | break; |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | if (depth_format != VK_FORMAT_UNDEFINED) |
| 109 | { |
| 110 | LOGI("Depth format selected: {}", to_string(depth_format)); |
| 111 | return depth_format; |
| 112 | } |
| 113 | |
| 114 | throw std::runtime_error("No suitable depth format could be determined"); |
| 115 | } |
| 116 | |
| 117 | VkFormat choose_blendable_format(VkPhysicalDevice physical_device, const std::vector<VkFormat> &format_priority_list) |
| 118 | { |
no test coverage detected