Fix physical_device_groups custom instance usage
authorRicardo Garcia <rgarcia@igalia.com>
Thu, 4 Aug 2022 15:43:33 +0000 (17:43 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 11 Aug 2022 16:18:58 +0000 (16:18 +0000)
The test is using a custom instance but misusing the default instance in
some API calls and expecting some consistency in the results.

In addition, the custom instance was not correctly collecting validation
error messages and some VkPhysicalDeviceGroupProperties structures were
not setting the sType as expected.

Affects:
dEQP-VK.info.physical_device_groups

Components: Vulkan
VK-GL-CTS issue: 3876

Change-Id: I3900723034bddb2dee0aaaab549cc6d362b1339e

external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp

index 50ed125..1e9069c 100644 (file)
@@ -1832,10 +1832,21 @@ struct CheckEnumeratePhysicalDevicesIncompleteResult : public CheckIncompleteRes
 
 struct CheckEnumeratePhysicalDeviceGroupsIncompleteResult : public CheckIncompleteResult<VkPhysicalDeviceGroupProperties>
 {
-       void getResult (Context& context, VkPhysicalDeviceGroupProperties* data)
+       CheckEnumeratePhysicalDeviceGroupsIncompleteResult (const InstanceInterface& vki, const VkInstance instance)
+               : m_vki                 (vki)
+               , m_instance    (instance)
+               {}
+
+       void getResult (Context&, VkPhysicalDeviceGroupProperties* data)
        {
-               m_result = context.getInstanceInterface().enumeratePhysicalDeviceGroups(context.getInstance(), &m_count, data);
+               for (uint32_t idx = 0u; idx < m_count; ++idx)
+                       data[idx] = initVulkanStructure();
+               m_result = m_vki.enumeratePhysicalDeviceGroups(m_instance, &m_count, data);
        }
+
+protected:
+       const InstanceInterface&        m_vki;
+       const VkInstance                        m_instance;
 };
 
 struct CheckEnumerateInstanceLayerPropertiesIncompleteResult : public CheckIncompleteResult<VkLayerProperties>
@@ -1902,7 +1913,7 @@ tcu::TestStatus enumeratePhysicalDeviceGroups (Context& context)
 {
        TestLog&                                                                                        log                             = context.getTestContext().getLog();
        tcu::ResultCollector                                                            results                 (log);
-       const CustomInstance                                                            instance                (createCustomInstanceWithExtension(context, "VK_KHR_device_group_creation"));
+       CustomInstance                                                                          instance                (createCustomInstanceWithExtension(context, "VK_KHR_device_group_creation"));
        const InstanceDriver&                                                           vki                             (instance.getDriver());
        const vector<VkPhysicalDeviceGroupProperties>           devicegroups    = enumeratePhysicalDeviceGroups(vki, instance);
 
@@ -1911,8 +1922,9 @@ tcu::TestStatus enumeratePhysicalDeviceGroups (Context& context)
        for (size_t ndx = 0; ndx < devicegroups.size(); ndx++)
                log << TestLog::Message << ndx << ": " << devicegroups[ndx] << TestLog::EndMessage;
 
-       CheckEnumeratePhysicalDeviceGroupsIncompleteResult()(context, results, devicegroups.size());
+       CheckEnumeratePhysicalDeviceGroupsIncompleteResult(vki, instance)(context, results, devicegroups.size());
 
+       instance.collectMessages();
        return tcu::TestStatus(results.getResult(), results.getMessage());
 }