MayaFlux 0.5.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 322 of file VKSwapchain.cpp.

326{
327 vk::Format vk_format = to_vk_format(desired_format);
328 vk::ColorSpaceKHR vk_color_space = to_vk_color_space(desired_color_space);
329
330 for (const auto& format : available_formats) {
331 if (format.format == vk_format && format.colorSpace == vk_color_space) {
332 return format;
333 }
334 }
335
336 for (const auto& format : available_formats) {
337 if (format.format == vk_format) {
339 "Exact color space match not found, using format match with different color space");
340 return format;
341 }
342 }
343
345 "Desired format not available, falling back to: {}",
346 vk::to_string(available_formats[0].format));
347 return available_formats[0];
348}
#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)
@ 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: