MCPcopy Create free account
hub / github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator / ChooseSurfaceFormat

Function ChooseSurfaceFormat

src/VulkanSample.cpp:354–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352}
353
354static VkSurfaceFormatKHR ChooseSurfaceFormat()
355{
356 assert(!g_SurfaceFormats.empty());
357
358 if((g_SurfaceFormats.size() == 1) && (g_SurfaceFormats[0].format == VK_FORMAT_UNDEFINED))
359 {
360 VkSurfaceFormatKHR result = { VK_FORMAT_B8G8R8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR };
361 return result;
362 }
363
364 for(const auto& format : g_SurfaceFormats)
365 {
366 if((format.format == VK_FORMAT_B8G8R8A8_UNORM) &&
367 (format.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR))
368 {
369 return format;
370 }
371 }
372
373 return g_SurfaceFormats[0];
374}
375
376VkPresentModeKHR ChooseSwapPresentMode()
377{

Callers 1

CreateSwapchainFunction · 0.85

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected