Macos ios fixes (#1192)
* Configure MoltenVK to use a dedicated compute queue for compute[*] examples with sync barriers * Modify descriptorindexing example for iOS and variable descriptor count limitations on MoltenVK * Remove obsolete macOS #ifdefs no longer needed for modern MoltenVK versions * Update iOS project to fix missing vkloader.c reference and revise example list * Set required features and API version for VVL in debugprintf example * Remove unnecessary Apple-specific code from descriptorindexing example * Add Layer Settings capability to VulkanExampleBase::createInstance() * Replace setenv() in examples with Layer Settings configuration for macOS/iOS * Update comments in examples.h and fix missing initializer in computeraytracing example * Update imgui overlay and example to support iOS Simulator * Update more comments in examples.h and remove redundant initializers in deferred* examples * Separate variable descriptor count declarations for apple and non-apple platforms * Consolidate variable descriptor count declarations for apple vs. non-apple platforms * Configure MoltenVK with a dedicated compute queue in VulkanExampleBase() and remove from samples
This commit is contained in:
parent
e1c962289f
commit
9a562a5426
17 changed files with 221 additions and 83 deletions
|
|
@ -111,7 +111,7 @@ VkResult VulkanExampleBase::createInstance()
|
|||
if (std::find(supportedInstanceExtensions.begin(), supportedInstanceExtensions.end(), VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME) != supportedInstanceExtensions.end())
|
||||
{
|
||||
instanceExtensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
|
||||
instanceCreateInfo.flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
|
||||
instanceCreateInfo.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -148,6 +148,18 @@ VkResult VulkanExampleBase::createInstance()
|
|||
std::cerr << "Validation layer VK_LAYER_KHRONOS_validation not present, validation is disabled";
|
||||
}
|
||||
}
|
||||
|
||||
// If layer settings are defined, then activate the sample's required layer settings during instance creation.
|
||||
// Layer settings are typically used to activate specific features of a layer, such as the Validation Layer's
|
||||
// printf feature, or to configure specific capabilities of drivers such as MoltenVK on macOS and/or iOS.
|
||||
VkLayerSettingsCreateInfoEXT layerSettingsCreateInfo{VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT};
|
||||
if (enabledLayerSettings.size() > 0) {
|
||||
layerSettingsCreateInfo.settingCount = static_cast<uint32_t>(enabledLayerSettings.size());
|
||||
layerSettingsCreateInfo.pSettings = enabledLayerSettings.data();
|
||||
layerSettingsCreateInfo.pNext = instanceCreateInfo.pNext;
|
||||
instanceCreateInfo.pNext = &layerSettingsCreateInfo;
|
||||
}
|
||||
|
||||
VkResult result = vkCreateInstance(&instanceCreateInfo, nullptr, &instance);
|
||||
|
||||
// If the debug utils extension is present we set up debug functions, so samples can label objects for debugging
|
||||
|
|
@ -853,6 +865,21 @@ VulkanExampleBase::VulkanExampleBase()
|
|||
if(commandLineParser.isSet("resourcepath")) {
|
||||
vks::tools::resourcePath = commandLineParser.getValueAsString("resourcepath", "");
|
||||
}
|
||||
#else
|
||||
// On Apple platforms, use layer settings extension to configure MoltenVK with common project config settings
|
||||
enabledInstanceExtensions.push_back(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME);
|
||||
|
||||
// Configure MoltenVK to use to use a dedicated compute queue (see compute[*] and timelinesemaphore samples)
|
||||
VkLayerSettingEXT layerSetting;
|
||||
layerSetting.pLayerName = "MoltenVK";
|
||||
layerSetting.pSettingName = "MVK_CONFIG_SPECIALIZED_QUEUE_FAMILIES";
|
||||
layerSetting.type = VK_LAYER_SETTING_TYPE_BOOL32_EXT;
|
||||
layerSetting.valueCount = 1;
|
||||
|
||||
// Make this static so layer setting reference remains valid after leaving constructor scope
|
||||
static const VkBool32 layerSettingOn = VK_TRUE;
|
||||
layerSetting.pValues = &layerSettingOn;
|
||||
enabledLayerSettings.push_back(layerSetting);
|
||||
#endif
|
||||
|
||||
#if !defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue