MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ choose_surface_format()

vk::SurfaceFormatKHR MayaFlux::Core::VKSwapchain::choose_surface_format ( const std::vector< vk::SurfaceFormatKHR > &  available_formats,
GraphicsSurfaceInfo::SurfaceFormat  desired_format,
GraphicsSurfaceInfo::ColorSpace  desired_color_space 
) const
private

Choose best surface format from available formats based on config.

Definition at line 321 of file VKSwapchain.cpp.

325{
326 vk::Format vk_format = to_vk_format(desired_format);
327 vk::ColorSpaceKHR vk_color_space = to_vk_color_space(desired_color_space);
328
329 for (const auto& format : available_formats) {
330 if (format.format == vk_format && format.colorSpace == vk_color_space) {
331 return format;
332 }
333 }
334
335 for (const auto& format : available_formats) {
336 if (format.format == vk_format) {
338 "Exact color space match not found, using format match with different color space");
339 return format;
340 }
341 }
342
344 "Desired format not available, falling back to: {}",
345 vk::to_string(available_formats[0].format));
346 return available_formats[0];
347}
#define MF_WARN(comp, ctx,...)
vk::Format to_vk_format(GraphicsSurfaceInfo::SurfaceFormat fmt)
vk::ColorSpaceKHR to_vk_color_space(GraphicsSurfaceInfo::ColorSpace space)
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
std::string format(format_string< std::remove_cvref_t< Args >... > fmt_str, Args &&... args)
Definition Format.hpp:30
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, MayaFlux::Journal::GraphicsBackend, MF_WARN, MayaFlux::Core::to_vk_color_space(), and MayaFlux::Core::to_vk_format().

Referenced by create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: