MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Tools / pick_surface_format

Method pick_surface_format

cube/cube.cpp:3116–3133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3114}
3115
3116vk::SurfaceFormatKHR Demo::pick_surface_format(const std::vector<vk::SurfaceFormatKHR> &surface_formats) {
3117 // Prefer non-SRGB formats...
3118 for (const auto &surface_format : surface_formats) {
3119 const vk::Format format = surface_format.format;
3120
3121 if (format == vk::Format::eR8G8B8A8Unorm || format == vk::Format::eB8G8R8A8Unorm ||
3122 format == vk::Format::eA2B10G10R10UnormPack32 || format == vk::Format::eA2R10G10B10UnormPack32 ||
3123 format == vk::Format::eA1R5G5B5UnormPack16 || format == vk::Format::eR5G6B5UnormPack16 ||
3124 format == vk::Format::eR16G16B16A16Sfloat) {
3125 return surface_format;
3126 }
3127 }
3128
3129 printf("Can't find our preferred formats... Falling back to first exposed format. Rendering may be incorrect.\n");
3130
3131 assert(surface_formats.size() >= 1);
3132 return surface_formats[0];
3133}
3134
3135#if defined(VK_USE_PLATFORM_WIN32_KHR)
3136template <>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected