Check VkPhysicalDevicePushDescriptorPropertiesKHR
authorSlawomir Cygan <slawomir.cygan@intel.com>
Fri, 2 Mar 2018 16:37:20 +0000 (17:37 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Mon, 26 Mar 2018 08:41:18 +0000 (04:41 -0400)
This adds test for getting VkPhysicalDevicePushDescriptorPropertiesKHR
using vkGetPhysicalDeviceProperties2. The test also verifies
maxPushDescriptors against spec requiremnts.

Components: Vulkan

VK-GL-CTS Issue: 1053

Affects:
dEQP-VK.api.info.get_physical_device_properties2.properties

Change-Id: I44ee1b0a3005d149cc7fb3c60414a412e36c45a4

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

index e31f610..1b7a616 100644 (file)
@@ -2662,6 +2662,16 @@ string toString (const VkPhysicalDeviceVariablePointerFeatures& value)
        return s.str();
 }
 
+string toString(const VkPhysicalDevicePushDescriptorPropertiesKHR& value)
+{
+       std::ostringstream      s;
+       s << "VkPhysicalDevicePushDescriptorPropertiesKHR = {\n";
+       s << "\tsType = " << value.sType << '\n';
+       s << "\tmaxPushDescriptors = " << value.maxPushDescriptors << '\n';
+       s << '}';
+       return s.str();
+}
+
 bool checkExtension (vector<VkExtensionProperties>& properties, const char* extension)
 {
        for (size_t ndx = 0; ndx < properties.size(); ++ndx)
@@ -2978,6 +2988,40 @@ tcu::TestStatus deviceProperties2 (Context& context)
                << TestLog::Message             << toString(pointClippingProperties[0])                 << TestLog::EndMessage
                << TestLog::Message             << toString(protectedMemoryPropertiesKHR[0])    << TestLog::EndMessage
                << TestLog::Message             << toString(subgroupProperties[0])                              << TestLog::EndMessage;
+               }
+
+               const vector<VkExtensionProperties>     extensions = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
+
+               if (isExtensionSupported(extensions, RequiredExtension("VK_KHR_push_descriptor")))
+               {
+                       const int count = 2u;
+                       VkPhysicalDevicePushDescriptorPropertiesKHR             pushDescriptorProperties[count];
+
+                       for (int ndx = 0; ndx < count; ++ndx)
+                       {
+                               deMemset(&pushDescriptorProperties[ndx], 0, sizeof(VkPhysicalDevicePushDescriptorPropertiesKHR));
+
+                               pushDescriptorProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR;
+                               pushDescriptorProperties[ndx].pNext     = DE_NULL;
+
+                               extProperties.pNext = &pushDescriptorProperties[ndx];
+
+                               vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
+
+                               pushDescriptorProperties[ndx].pNext = DE_NULL;
+                       }
+
+                       if (deMemCmp(&pushDescriptorProperties[0], &pushDescriptorProperties[1], sizeof(VkPhysicalDevicePushDescriptorPropertiesKHR)) != 0)
+                       {
+                               TCU_FAIL("Mismatch in vkGetPhysicalDeviceProperties2 in VkPhysicalDevicePushDescriptorPropertiesKHR ");
+                       }
+
+                       log << TestLog::Message << toString(pushDescriptorProperties[0]) << TestLog::EndMessage;
+
+                       if (pushDescriptorProperties[0].maxPushDescriptors < 32)
+                       {
+                               TCU_FAIL("VkPhysicalDevicePushDescriptorPropertiesKHR.maxPushDescriptors must be at least 32");
+                       }
        }
 
        return tcu::TestStatus::pass("Querying device properties succeeded");