Merge pull request #52676 from Calinou/vulkan-version-print-same-line

Print the Vulkan API version and device used on the same line
This commit is contained in:
Rémi Verschelde 2021-09-14 21:08:47 +02:00 committed by GitHub
commit 3d577f065a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -275,22 +275,21 @@ Error VulkanContext::_obtain_vulkan_version() {
if (res == VK_SUCCESS) { if (res == VK_SUCCESS) {
vulkan_major = VK_VERSION_MAJOR(api_version); vulkan_major = VK_VERSION_MAJOR(api_version);
vulkan_minor = VK_VERSION_MINOR(api_version); vulkan_minor = VK_VERSION_MINOR(api_version);
uint32_t vulkan_patch = VK_VERSION_PATCH(api_version); vulkan_patch = VK_VERSION_PATCH(api_version);
print_line("Vulkan API " + itos(vulkan_major) + "." + itos(vulkan_minor) + "." + itos(vulkan_patch));
} else { } else {
// according to the documentation this shouldn't fail with anything except a memory allocation error // according to the documentation this shouldn't fail with anything except a memory allocation error
// in which case we're in deep trouble anyway // in which case we're in deep trouble anyway
ERR_FAIL_V(ERR_CANT_CREATE); ERR_FAIL_V(ERR_CANT_CREATE);
} }
} else { } else {
print_line("vkEnumerateInstanceVersion not available, assuming Vulkan 1.0"); print_line("vkEnumerateInstanceVersion not available, assuming Vulkan 1.0.");
} }
// we don't go above 1.2 // we don't go above 1.2
if ((vulkan_major > 1) || (vulkan_major == 1 && vulkan_minor > 2)) { if ((vulkan_major > 1) || (vulkan_major == 1 && vulkan_minor > 2)) {
vulkan_major = 1; vulkan_major = 1;
vulkan_minor = 2; vulkan_minor = 2;
vulkan_patch = 0;
} }
return OK; return OK;
@ -759,7 +758,9 @@ Error VulkanContext::_create_physical_device() {
} }
} }
print_line("Using Vulkan Device #" + itos(device_index) + ": " + device_vendor + " - " + device_name); print_line(
"Vulkan API " + itos(vulkan_major) + "." + itos(vulkan_minor) + "." + itos(vulkan_patch) +
" - " + "Using Vulkan Device #" + itos(device_index) + ": " + device_vendor + " - " + device_name);
device_api_version = gpu_props.apiVersion; device_api_version = gpu_props.apiVersion;

View File

@ -85,6 +85,7 @@ private:
// Vulkan 1.0 doesn't return version info so we assume this by default until we know otherwise // Vulkan 1.0 doesn't return version info so we assume this by default until we know otherwise
uint32_t vulkan_major = 1; uint32_t vulkan_major = 1;
uint32_t vulkan_minor = 0; uint32_t vulkan_minor = 0;
uint32_t vulkan_patch = 0;
SubgroupCapabilities subgroup_capabilities; SubgroupCapabilities subgroup_capabilities;
MultiviewCapabilities multiview_capabilities; MultiviewCapabilities multiview_capabilities;