62 :
PlaygroundImpl(switches), handle_(
nullptr, &DestroyWindowHandle) {
63 if (!::glfwVulkanSupported()) {
65 VALIDATION_LOG <<
"Attempted to initialize a Vulkan playground on macOS "
66 "where Vulkan cannot be found. It can be installed via "
67 "MoltenVK and make sure to install it globally so "
68 "dlopen can find it.";
70 VALIDATION_LOG <<
"Attempted to initialize a Vulkan playground on a system "
71 "that does not support Vulkan.";
76 InitGlobalVulkanInstance();
78 ::glfwDefaultWindowHints();
79 ::glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
80 ::glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
82 auto window = ::glfwCreateWindow(1, 1,
"Test",
nullptr,
nullptr);
88 handle_.reset(window);
90 ContextVK::Settings context_settings;
91 context_settings.proc_address_callback =
92 reinterpret_cast<PFN_vkGetInstanceProcAddr
>(
93 &::glfwGetInstanceProcAddress);
95 context_settings.cache_directory = fml::paths::GetCachesDirectory();
99 if (!context_vk || !context_vk->IsValid()) {
100 VALIDATION_LOG <<
"Could not create Vulkan context in the playground.";
111 context_vk->SetSyncPresentation(
true);
113 VkSurfaceKHR vk_surface;
114 auto res = vk::Result{::glfwCreateWindowSurface(
115 context_vk->GetInstance(),
120 if (res != vk::Result::eSuccess) {
122 << vk::to_string(res);
126 vk::UniqueSurfaceKHR surface{vk_surface, context_vk->GetInstance()};
127 auto context = context_vk->CreateSurfaceContext();
128 if (!context->SetWindowSurface(std::move(surface))) {
133 context_ = std::move(context);