xo-imgui: fix OSX bugs: use __APPLE__
This commit is contained in:
parent
d58a8532d4
commit
4e295c71b0
1 changed files with 11 additions and 2 deletions
|
|
@ -87,18 +87,22 @@ VulkanApp::create_instance()
|
||||||
throw std::runtime_error("Failed to get SDL Vulkan extensions!");
|
throw std::runtime_error("Failed to get SDL Vulkan extensions!");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __apple__
|
#ifdef __APPLE__
|
||||||
// Add portability extension for MoltenVK (macOS)
|
// Add portability extension for MoltenVK (macOS)
|
||||||
extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
|
extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
|
||||||
|
#else
|
||||||
|
static_assert(false, "expecting apple build");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
createInfo.enabledExtensionCount = extensions.size();
|
createInfo.enabledExtensionCount = extensions.size();
|
||||||
createInfo.ppEnabledExtensionNames = extensions.data();
|
createInfo.ppEnabledExtensionNames = extensions.data();
|
||||||
createInfo.enabledLayerCount = 0;
|
createInfo.enabledLayerCount = 0;
|
||||||
|
|
||||||
#ifdef __apple__
|
#ifdef __APPLE__
|
||||||
// CRITICAL: Enable portability enumeration flag for MoltenVK
|
// CRITICAL: Enable portability enumeration flag for MoltenVK
|
||||||
createInfo.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
|
createInfo.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
|
||||||
|
#else
|
||||||
|
static_assert(false, "expecting apple build");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int result = vkCreateInstance(&createInfo, nullptr, &(this->instance_));
|
int result = vkCreateInstance(&createInfo, nullptr, &(this->instance_));
|
||||||
|
|
@ -670,6 +674,11 @@ VulkanApp::cleanup_xswapchain()
|
||||||
void
|
void
|
||||||
VulkanApp::recreate_xswapchain()
|
VulkanApp::recreate_xswapchain()
|
||||||
{
|
{
|
||||||
|
#ifdef __APPLE__
|
||||||
|
// wait one frame. Apple window manager needs time to complete resize
|
||||||
|
SDL_Delay(16);
|
||||||
|
#endif
|
||||||
|
|
||||||
// handle window minimization: wait until window has valid size
|
// handle window minimization: wait until window has valid size
|
||||||
this->wait_not_minimized();
|
this->wait_not_minimized();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue