@@ -215,6 +215,42 @@ std::vector<std::string> getInstanceExtensionList(
215215 return foundExtensions;
216216}
217217
218+ /* See header for documentation. */
219+ std::vector<std::string> getDeviceExtensionList (
220+ VkInstance instance,
221+ VkPhysicalDevice physicalDevice,
222+ const VkDeviceCreateInfo* pCreateInfo
223+ ) {
224+ std::vector<std::string> foundExtensions;
225+
226+ // Fetch the functions needed to query extensions availability
227+ auto * chainInfo = getChainInfo (pCreateInfo);
228+ auto fpGetProcAddr = chainInfo->u .pLayerInfo ->pfnNextGetInstanceProcAddr ;
229+ auto fpGetExtensionsRaw = fpGetProcAddr (instance, " vkEnumerateDeviceExtensionProperties" );
230+ auto fpGetExtensions = reinterpret_cast <PFN_vkEnumerateDeviceExtensionProperties>(fpGetExtensionsRaw);
231+ if (!fpGetExtensions)
232+ {
233+ return foundExtensions;
234+ }
235+
236+ // Query number of extensions
237+ uint32_t count;
238+ fpGetExtensions (physicalDevice, nullptr , &count, nullptr );
239+
240+ // Reserve memory for, and then query, the extensions
241+ std::vector<VkExtensionProperties> extensions;
242+ extensions.resize (count);
243+ fpGetExtensions (physicalDevice, nullptr , &count, extensions.data ());
244+
245+ // Build the function return list
246+ for (uint32_t i = 0 ; i < count; i++)
247+ {
248+ foundExtensions.emplace_back (extensions[i].extensionName );
249+ }
250+
251+ return foundExtensions;
252+ }
253+
218254/* See header for documentation. */
219255bool isInExtensionList (
220256 const std::string& target,
0 commit comments