Skip to content
Snippets Groups Projects
Commit bce23e98 authored by Ludovico de Nittis's avatar Ludovico de Nittis
Browse files

Merge branch 'wip/smcv/heavy' into 'master'

check-vulkan: Fix build with Vulkan 1.1 headers

See merge request !407
parents 552f66ab 710c2b38
No related branches found
No related tags found
1 merge request!407check-vulkan: Fix build with Vulkan 1.1 headers
...@@ -260,7 +260,11 @@ create_instance (VkInstance *vk_instance, ...@@ -260,7 +260,11 @@ create_instance (VkInstance *vk_instance,
/* Since Vulkan 1.1, it is valid to pass in a higher API version and /* Since Vulkan 1.1, it is valid to pass in a higher API version and
* the implementation will use MIN(what it supports, what we ask for). */ * the implementation will use MIN(what it supports, what we ask for). */
if (api_version >= VK_API_VERSION_1_1) if (api_version >= VK_API_VERSION_1_1)
#if VK_HEADER_VERSION >= 131
app.apiVersion = VK_API_VERSION_1_2; app.apiVersion = VK_API_VERSION_1_2;
#else
app.apiVersion = VK_API_VERSION_1_1;
#endif
if (!do_vk (vkCreateInstance (&inst_info, NULL, vk_instance), error)) if (!do_vk (vkCreateInstance (&inst_info, NULL, vk_instance), error))
return FALSE; return FALSE;
...@@ -1278,8 +1282,10 @@ print_physical_device_info (VkInstance instance, ...@@ -1278,8 +1282,10 @@ print_physical_device_info (VkInstance instance,
g_autofree gchar *vendor_id = NULL; g_autofree gchar *vendor_id = NULL;
g_autofree gchar *device_id = NULL; g_autofree gchar *device_id = NULL;
VkPhysicalDeviceProperties2 device_properties = {}; VkPhysicalDeviceProperties2 device_properties = {};
#if VK_HEADER_VERSION >= 131
VkPhysicalDeviceVulkan12Properties props12 = {}; VkPhysicalDeviceVulkan12Properties props12 = {};
PFN_vkGetPhysicalDeviceProperties2 get_props2 = NULL; PFN_vkGetPhysicalDeviceProperties2 get_props2 = NULL;
#endif
builder = json_builder_new (); builder = json_builder_new ();
json_builder_begin_object (builder); json_builder_begin_object (builder);
...@@ -1295,6 +1301,7 @@ print_physical_device_info (VkInstance instance, ...@@ -1295,6 +1301,7 @@ print_physical_device_info (VkInstance instance,
* overwriting this. */ * overwriting this. */
vkGetPhysicalDeviceProperties (physical_device, &device_properties.properties); vkGetPhysicalDeviceProperties (physical_device, &device_properties.properties);
#if VK_HEADER_VERSION >= 131
if (device_properties.properties.apiVersion >= VK_API_VERSION_1_2) if (device_properties.properties.apiVersion >= VK_API_VERSION_1_2)
{ {
/* Vulkan 1.2: we can get the driver name and info (version) from the /* Vulkan 1.2: we can get the driver name and info (version) from the
...@@ -1310,6 +1317,7 @@ print_physical_device_info (VkInstance instance, ...@@ -1310,6 +1317,7 @@ print_physical_device_info (VkInstance instance,
else else
g_warning ("Unable to find vkGetPhysicalDeviceProperties2"); g_warning ("Unable to find vkGetPhysicalDeviceProperties2");
} }
#endif
json_builder_set_member_name (builder, "device-name"); json_builder_set_member_name (builder, "device-name");
json_builder_add_string_value (builder, device_properties.properties.deviceName); json_builder_add_string_value (builder, device_properties.properties.deviceName);
...@@ -1328,6 +1336,7 @@ print_physical_device_info (VkInstance instance, ...@@ -1328,6 +1336,7 @@ print_physical_device_info (VkInstance instance,
driver_version = g_strdup_printf ("%#x", device_properties.properties.driverVersion); driver_version = g_strdup_printf ("%#x", device_properties.properties.driverVersion);
json_builder_add_string_value (builder, driver_version); json_builder_add_string_value (builder, driver_version);
#if VK_HEADER_VERSION >= 131
if (props12.driverID != 0) if (props12.driverID != 0)
{ {
json_builder_set_member_name (builder, "driver-id"); json_builder_set_member_name (builder, "driver-id");
...@@ -1345,6 +1354,7 @@ print_physical_device_info (VkInstance instance, ...@@ -1345,6 +1354,7 @@ print_physical_device_info (VkInstance instance,
json_builder_set_member_name (builder, "driver-info"); json_builder_set_member_name (builder, "driver-info");
json_builder_add_string_value (builder, props12.driverInfo); json_builder_add_string_value (builder, props12.driverInfo);
} }
#endif
json_builder_set_member_name (builder, "vendor-id"); json_builder_set_member_name (builder, "vendor-id");
vendor_id = g_strdup_printf ("%#x", device_properties.properties.vendorID); vendor_id = g_strdup_printf ("%#x", device_properties.properties.vendorID);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment