MCPcopy Create free account
hub / github.com/begla/Intrinsic / initVkDevice

Method initVkDevice

IntrinsicCore/src/IntrinsicRendererRenderSystem.cpp:599–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

597// <-
598
599void RenderSystem::initVkDevice()
600{
601 _INTR_LOG_INFO("Creating Vulkan device...");
602 _INTR_LOG_PUSH();
603
604 // Retrieve the physical device and its features
605 {
606 uint32_t deviceCount;
607 VkResult result =
608 vkEnumeratePhysicalDevices(_vkInstance, &deviceCount, nullptr);
609 _INTR_VK_CHECK_RESULT(result);
610 _INTR_ASSERT(deviceCount >= 1u && "No Vulkan capable Device found");
611
612 _INTR_LOG_INFO("Found %u available physical devices...", deviceCount);
613
614 _INTR_ARRAY(VkPhysicalDevice) physDevs;
615 physDevs.resize(deviceCount);
616
617 result =
618 vkEnumeratePhysicalDevices(_vkInstance, &deviceCount, physDevs.data());
619 _INTR_VK_CHECK_RESULT(result);
620
621 // Always use the first device found
622 _vkPhysicalDevice = physDevs[0];
623
624 vkGetPhysicalDeviceProperties(_vkPhysicalDevice, &_vkPhysicalDeviceProps);
625 vkGetPhysicalDeviceFeatures(_vkPhysicalDevice, &_vkPhysicalDeviceFeatures);
626
627 // Queue memory properties
628 vkGetPhysicalDeviceMemoryProperties(_vkPhysicalDevice,
629 &_vkPhysicalDeviceMemoryProperties);
630
631 _INTR_LOG_INFO(
632 "Using physical device %s (Driver Ver. %u, API Ver. %u, "
633 "Vendor ID %u, Device ID %u, Device Type %u)...",
634 _vkPhysicalDeviceProps.deviceName, _vkPhysicalDeviceProps.driverVersion,
635 _vkPhysicalDeviceProps.apiVersion, _vkPhysicalDeviceProps.vendorID,
636 _vkPhysicalDeviceProps.deviceID, _vkPhysicalDeviceProps.deviceType);
637 }
638
639 // Find graphics _AND_ compute queue
640 {
641 _INTR_LOG_INFO("Retrieving compute and graphics queues...");
642
643 uint32_t queueCount;
644 vkGetPhysicalDeviceQueueFamilyProperties(_vkPhysicalDevice, &queueCount,
645 nullptr);
646 _INTR_ASSERT(queueCount >= 1u);
647
648 _INTR_LOG_INFO("Found %u available queues...", queueCount);
649
650 _INTR_ARRAY(VkQueueFamilyProperties) queueProps;
651 queueProps.resize(queueCount);
652 vkGetPhysicalDeviceQueueFamilyProperties(_vkPhysicalDevice, &queueCount,
653 queueProps.data());
654
655 for (uint32_t queueIdx = 0; queueIdx < queueCount; queueIdx++)
656 {

Callers

nothing calls this directly

Calls 4

resizeMethod · 0.80
dataMethod · 0.80
push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected