| 169 | } |
| 170 | |
| 171 | void VkRenderFramework::InitFramework(void* instance_pnext) { |
| 172 | ASSERT_EQ((VkInstance)0, instance_); |
| 173 | |
| 174 | const auto ExtensionIncludedInTargetVersion = [this](const char* extension) { |
| 175 | if (IsPromotedInstanceExtension(extension)) { |
| 176 | // Replicate the core entry points into the extension entry points |
| 177 | vk::InitExtensionFromCore(extension); |
| 178 | return true; |
| 179 | } |
| 180 | return false; |
| 181 | }; |
| 182 | const auto LayerNotSupportedWithReporting = [this](const char* layer) { |
| 183 | if (InstanceLayerSupported(layer)) |
| 184 | return false; |
| 185 | else { |
| 186 | ADD_FAILURE() << "InitFramework(): Requested layer \"" << layer << "\" is not supported. It will be disabled."; |
| 187 | return true; |
| 188 | } |
| 189 | }; |
| 190 | const auto ExtensionNotSupportedWithReporting = [this](const char* extension) { |
| 191 | if (InstanceExtensionSupported(extension)) |
| 192 | return false; |
| 193 | else { |
| 194 | ADD_FAILURE() << "InitFramework(): Requested extension \"" << extension << "\" is not supported. It will be disabled."; |
| 195 | return true; |
| 196 | } |
| 197 | }; |
| 198 | |
| 199 | // Beginning with the 1.3.216 Vulkan SDK, the VK_KHR_PORTABILITY_subset extension is mandatory. |
| 200 | #ifdef VK_USE_PLATFORM_METAL_EXT |
| 201 | AddRequiredExtensions(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME); |
| 202 | // VK_KHR_portability_subset requires VK_KHR_get_physical_device_properties2. We always request it since we don't know if we |
| 203 | // will be using KK or MoltenVK until device selection, so if we wouldn't enable it, we would have to recreate the instance... |
| 204 | if (InstanceExtensionSupported(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) |
| 205 | AddRequiredExtensions(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
| 206 | #else |
| 207 | // Note by default VK_KHRONOS_PROFILES_EMULATE_PORTABILITY is true. |
| 208 | if (auto str = GetEnvironment("VK_KHRONOS_PROFILES_EMULATE_PORTABILITY"); !str.empty() && str != "false") { |
| 209 | AddRequiredExtensions(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME); |
| 210 | AddRequiredExtensions(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME); |
| 211 | } |
| 212 | #endif |
| 213 | |
| 214 | vk::ResetAllExtensions(); |
| 215 | |
| 216 | // Remove promoted extensions from both the instance and required extension lists |
| 217 | if (!allow_promoted_extensions_) { |
| 218 | RemoveIf(m_required_extensions, ExtensionIncludedInTargetVersion); |
| 219 | RemoveIf(m_optional_extensions, ExtensionIncludedInTargetVersion); |
| 220 | RemoveIf(m_instance_extension_names, ExtensionIncludedInTargetVersion); |
| 221 | } |
| 222 | |
| 223 | RemoveIf(instance_layers_, LayerNotSupportedWithReporting); |
| 224 | RemoveIf(m_instance_extension_names, ExtensionNotSupportedWithReporting); |
| 225 | |
| 226 | auto ici = GetInstanceCreateInfo(); |
| 227 | |
| 228 | // concatenate pNexts |
nothing calls this directly
no test coverage detected