MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / get_suitable_depth_format

Function get_suitable_depth_format

framework/common/vk_common.cpp:86–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84VkFormat 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
117VkFormat choose_blendable_format(VkPhysicalDevice physical_device, const std::vector<VkFormat> &format_priority_list)
118{

Callers 13

prepareMethod · 0.50
prepareMethod · 0.50
create_render_targetMethod · 0.50
create_render_targetMethod · 0.50
create_render_targetMethod · 0.50
create_render_targetMethod · 0.50
create_render_targetMethod · 0.50
prepareMethod · 0.50
prepare_offscreenMethod · 0.50

Calls 2

is_depth_only_formatFunction · 0.70
to_stringFunction · 0.70

Tested by

no test coverage detected