Fix TestICD enabled instance extension tracking
authorCharles Giessen <charles@lunarg.com>
Thu, 21 Mar 2024 17:51:26 +0000 (12:51 -0500)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Mon, 29 Apr 2024 16:53:33 +0000 (10:53 -0600)
tests/framework/icd/test_icd.cpp
tests/framework/icd/test_icd.h
tests/framework/layer/test_layer.cpp

index febaa7fde69522a033dedd9c8028ecbd92f21623..067fe65f24d6719da099166f1ca5e525d2568274 100644 (file)
@@ -194,9 +194,10 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateInstance(const VkInstanceCreateInfo*
     }
 
     // Add to the list of enabled extensions only those that the ICD actively supports
-    for (uint32_t iii = 0; iii < pCreateInfo->enabledExtensionCount; ++iii) {
-        if (IsInstanceExtensionSupported(pCreateInfo->ppEnabledExtensionNames[iii])) {
-            icd.add_enabled_instance_extension({pCreateInfo->ppEnabledExtensionNames[iii]});
+    icd.enabled_instance_extensions.clear();
+    for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
+        if (IsInstanceExtensionSupported(pCreateInfo->ppEnabledExtensionNames[i])) {
+            icd.enabled_instance_extensions.push_back({pCreateInfo->ppEnabledExtensionNames[i]});
         }
     }
 
@@ -209,7 +210,9 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateInstance(const VkInstanceCreateInfo*
 }
 
 VKAPI_ATTR void VKAPI_CALL test_vkDestroyInstance([[maybe_unused]] VkInstance instance,
-                                                  [[maybe_unused]] const VkAllocationCallbacks* pAllocator) {}
+                                                  [[maybe_unused]] const VkAllocationCallbacks* pAllocator) {
+    icd.enabled_instance_extensions.clear();
+}
 
 // VK_SUCCESS,VK_INCOMPLETE
 VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumeratePhysicalDevices([[maybe_unused]] VkInstance instance, uint32_t* pPhysicalDeviceCount,
index d9a748f7fc945a7021ca0c593982860d02550612..d0a5a96a54263d47642c49fe128c3bf3910610a8 100644 (file)
@@ -108,7 +108,7 @@ struct TestICD {
     BUILDER_VALUE(TestICD, uint32_t, icd_api_version, VK_API_VERSION_1_0)
     BUILDER_VECTOR(TestICD, LayerDefinition, instance_layers, instance_layer)
     BUILDER_VECTOR(TestICD, Extension, instance_extensions, instance_extension)
-    BUILDER_VECTOR(TestICD, Extension, enabled_instance_extensions, enabled_instance_extension)
+    std::vector<Extension> enabled_instance_extensions;
 
     BUILDER_VECTOR_MOVE_ONLY(TestICD, PhysicalDevice, physical_devices, physical_device);
 
index 14f0ebd6032ad5b943f872517154e0779074a37f..4fca974df98570fde7638640870dbc0ae7d7fdb1 100644 (file)
@@ -297,6 +297,7 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateInstance(const VkInstanceCreateInfo*
     // next layer in the chain.
     layer_init_instance_dispatch_table(layer.instance_handle, &layer.instance_dispatch_table, fpGetInstanceProcAddr);
 
+    layer.enabled_instance_extensions.clear();
     for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
         layer.enabled_instance_extensions.push_back({pCreateInfo->ppEnabledExtensionNames[i]});
     }
@@ -377,6 +378,7 @@ VKAPI_ATTR void VKAPI_CALL test_vkDestroyInstance(VkInstance instance, const VkA
         pAllocator->pfnFree(pAllocator->pUserData, layer.spurious_instance_memory_allocation);
         layer.spurious_instance_memory_allocation = nullptr;
     }
+    layer.enabled_instance_extensions.clear();
 
     layer.instance_dispatch_table.DestroyInstance(instance, pAllocator);
 }