mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Add Vulkan 1.1 support to glfwinfo
(cherry picked from commit 700d1f28d8
)
This commit is contained in:
parent
4d99045e87
commit
9f5c6c6e89
@ -809,6 +809,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
if (glfwVulkanSupported())
|
if (glfwVulkanSupported())
|
||||||
{
|
{
|
||||||
|
uint32_t loader_version = VK_API_VERSION_1_0;
|
||||||
uint32_t i, re_count, pd_count;
|
uint32_t i, re_count, pd_count;
|
||||||
const char** re;
|
const char** re;
|
||||||
VkApplicationInfo ai = {0};
|
VkApplicationInfo ai = {0};
|
||||||
@ -818,6 +819,17 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, NULL);
|
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, NULL);
|
||||||
|
|
||||||
|
if (vkEnumerateInstanceVersion)
|
||||||
|
{
|
||||||
|
uint32_t version;
|
||||||
|
if (vkEnumerateInstanceVersion(&version) == VK_SUCCESS)
|
||||||
|
loader_version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Vulkan loader API version: %i.%i\n",
|
||||||
|
VK_VERSION_MAJOR(loader_version),
|
||||||
|
VK_VERSION_MINOR(loader_version));
|
||||||
|
|
||||||
re = glfwGetRequiredInstanceExtensions(&re_count);
|
re = glfwGetRequiredInstanceExtensions(&re_count);
|
||||||
|
|
||||||
printf("Vulkan required instance extensions:");
|
printf("Vulkan required instance extensions:");
|
||||||
@ -838,10 +850,14 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
ai.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
ai.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
||||||
ai.pApplicationName = "glfwinfo";
|
ai.pApplicationName = "glfwinfo";
|
||||||
ai.applicationVersion = GLFW_VERSION_MAJOR;
|
ai.applicationVersion = VK_MAKE_VERSION(GLFW_VERSION_MAJOR,
|
||||||
ai.pEngineName = "GLFW";
|
GLFW_VERSION_MINOR,
|
||||||
ai.engineVersion = GLFW_VERSION_MAJOR;
|
GLFW_VERSION_REVISION);
|
||||||
ai.apiVersion = VK_API_VERSION_1_0;
|
|
||||||
|
if (loader_version >= VK_API_VERSION_1_1)
|
||||||
|
ai.apiVersion = VK_API_VERSION_1_1;
|
||||||
|
else
|
||||||
|
ai.apiVersion = VK_API_VERSION_1_0;
|
||||||
|
|
||||||
ici.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
ici.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||||
ici.pApplicationInfo = &ai;
|
ici.pApplicationInfo = &ai;
|
||||||
@ -879,9 +895,11 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
vkGetPhysicalDeviceProperties(pd[i], &pdp);
|
vkGetPhysicalDeviceProperties(pd[i], &pdp);
|
||||||
|
|
||||||
printf("Vulkan %s device: \"%s\"\n",
|
printf("Vulkan %s device: \"%s\" API version %i.%i\n",
|
||||||
get_device_type_name(pdp.deviceType),
|
get_device_type_name(pdp.deviceType),
|
||||||
pdp.deviceName);
|
pdp.deviceName,
|
||||||
|
VK_VERSION_MAJOR(pdp.apiVersion),
|
||||||
|
VK_VERSION_MINOR(pdp.apiVersion));
|
||||||
|
|
||||||
if (list_extensions)
|
if (list_extensions)
|
||||||
list_vulkan_device_extensions(instance, pd[i]);
|
list_vulkan_device_extensions(instance, pd[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user