56 :
PlaygroundImpl(switches), handle_(
nullptr, &DestroyWindowHandle) {
57 if (!::glfwVulkanSupported()) {
59 VALIDATION_LOG <<
"Attempted to initialize a Vulkan playground on macOS "
60 "where Vulkan cannot be found. It can be installed via "
61 "MoltenVK and make sure to install it globally so "
62 "dlopen can find it.";
64 VALIDATION_LOG <<
"Attempted to initialize a Vulkan playground on a system "
65 "that does not support Vulkan.";
70 ::glfwDefaultWindowHints();
71 ::glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
72 ::glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
74 auto window = ::glfwCreateWindow(1, 1,
"Test",
nullptr,
nullptr);
80 handle_.reset(window);
82 ContextVK::Settings context_settings;
83 context_settings.proc_address_callback =
84 reinterpret_cast<PFN_vkGetInstanceProcAddr
>(
85 &::glfwGetInstanceProcAddress);
87 context_settings.cache_directory = fml::paths::GetCachesDirectory();
91 if (!context_vk || !context_vk->IsValid()) {
92 VALIDATION_LOG <<
"Could not create Vulkan context in the playground.";
103 context_vk->SetSyncPresentation(
true);
105 VkSurfaceKHR vk_surface;
106 auto res = vk::Result{::glfwCreateWindowSurface(
107 context_vk->GetInstance(),
112 if (res != vk::Result::eSuccess) {
114 << vk::to_string(res);
118 vk::UniqueSurfaceKHR surface{vk_surface, context_vk->GetInstance()};
119 auto context = context_vk->CreateSurfaceContext();
120 if (!context->SetWindowSurface(std::move(surface))) {
125 context_ = std::move(context);