MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Tools / demo_create_device

Function demo_create_device

cube/cube.c:4464–4499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4462}
4463
4464static void demo_create_device(struct demo *demo) {
4465 VkResult U_ASSERT_ONLY err;
4466 float queue_priorities[1] = {0.0};
4467 VkDeviceQueueCreateInfo queues[2];
4468 queues[0].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
4469 queues[0].pNext = NULL;
4470 queues[0].queueFamilyIndex = demo->graphics_queue_family_index;
4471 queues[0].queueCount = 1;
4472 queues[0].pQueuePriorities = queue_priorities;
4473 queues[0].flags = 0;
4474
4475 VkDeviceCreateInfo device = {
4476 .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
4477 .pNext = NULL,
4478 .queueCreateInfoCount = 1,
4479 .pQueueCreateInfos = queues,
4480 .enabledLayerCount = 0,
4481 .ppEnabledLayerNames = NULL,
4482 .enabledExtensionCount = demo->enabled_extension_count,
4483 .ppEnabledExtensionNames = (const char *const *)demo->extension_names,
4484 .pEnabledFeatures = NULL, // If specific features are required, pass them in here
4485 };
4486 if (demo->separate_present_queue) {
4487 queues[1].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
4488 queues[1].pNext = NULL;
4489 queues[1].queueFamilyIndex = demo->present_queue_family_index;
4490 queues[1].queueCount = 1;
4491 queues[1].pQueuePriorities = queue_priorities;
4492 queues[1].flags = 0;
4493 device.queueCreateInfoCount = 2;
4494 }
4495 err = vkCreateDevice(demo->gpu, &device, NULL, &demo->device);
4496 assert(!err);
4497
4498 load_vulkan_device_functions(demo->device);
4499}
4500
4501static void demo_create_surface(struct demo *demo) {
4502 VkResult U_ASSERT_ONLY err = VK_SUCCESS;

Callers 1

demo_init_vk_swapchainFunction · 0.85

Calls 1

Tested by

no test coverage detected