MayaFlux 0.1.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 314 of file VKSwapchain.cpp.

318{
319 vk::Format vk_format = to_vk_format(desired_format);
320 vk::ColorSpaceKHR vk_color_space = to_vk_color_space(desired_color_space);
321
322 for (const auto& format : available_formats) {
323 if (format.format == vk_format && format.colorSpace == vk_color_space) {
324 return format;
325 }
326 }
327
328 for (const auto& format : available_formats) {
329 if (format.format == vk_format) {
331 "Exact color space match not found, using format match with different color space");
332 return format;
333 }
334 }
335
337 "Desired format not available, falling back to: {}",
338 vk::to_string(available_formats[0].format));
339 return available_formats[0];
340}
#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: