anv: Pull the API version from anv_extensions.py
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 1 Aug 2017 18:50:59 +0000 (11:50 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 2 Aug 2017 16:13:13 +0000 (09:13 -0700)
This way everything stays in sync and we only have the one version
number.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_extensions.py
src/intel/vulkan/anv_private.h

index 70b5cd1ec68cadc8705d3fc11c09609edaa184c3..793e519ad97f1348b380a7964bc8e7a41d36a8e7 100644 (file)
@@ -794,7 +794,7 @@ void anv_GetPhysicalDeviceProperties(
    };
 
    *pProperties = (VkPhysicalDeviceProperties) {
-      .apiVersion = VK_MAKE_VERSION(1, 0, 54),
+      .apiVersion = anv_physical_device_api_version(pdevice),
       .driverVersion = vk_get_driver_version(),
       .vendorID = 0x8086,
       .deviceID = pdevice->chipset_id,
index 7307cacbcac354156a2993d5e790d8f0651812b8..f4bfcf197bfe7ad39e01ceefc00467691fde01f8 100644 (file)
@@ -91,6 +91,10 @@ class VkVersion:
             ver_list.append(str(self.patch))
         return '.'.join(ver_list)
 
+    def c_vk_version(self):
+        ver_list = [str(self.major), str(self.minor), str(self.patch)]
+        return 'VK_MAKE_VERSION(' + ', '.join(ver_list) + ')'
+
     def __int_ver(self):
         # This is just an expansion of VK_VERSION
         patch = self.patch if self.patch is not None else 0
@@ -173,6 +177,12 @@ VkResult anv_EnumerateInstanceExtensionProperties(
     return vk_outarray_status(&out);
 }
 
+uint32_t
+anv_physical_device_api_version(struct anv_physical_device *dev)
+{
+    return ${MAX_API_VERSION.c_vk_version()};
+}
+
 bool
 anv_physical_device_extension_supported(struct anv_physical_device *device,
                                         const char *name)
@@ -218,6 +228,7 @@ if __name__ == '__main__':
     _init_exts_from_xml(args.xml)
 
     template_env = {
+        'MAX_API_VERSION': MAX_API_VERSION,
         'instance_extensions': [e for e in EXTENSIONS if e.type == 'instance'],
         'device_extensions': [e for e in EXTENSIONS if e.type == 'device'],
     }
index 818f6990dc7cd739b3f6efe630762aa420df9b67..c36449143280e1bab2a77f1d85ffdefe5fa2f364 100644 (file)
@@ -685,6 +685,7 @@ VkResult anv_init_wsi(struct anv_physical_device *physical_device);
 void anv_finish_wsi(struct anv_physical_device *physical_device);
 
 bool anv_instance_extension_supported(const char *name);
+uint32_t anv_physical_device_api_version(struct anv_physical_device *dev);
 bool anv_physical_device_extension_supported(struct anv_physical_device *dev,
                                              const char *name);