| 228 | } |
| 229 | |
| 230 | void vkRenderer::pickPhysicalDevice() { |
| 231 | uint32_t deviceCount = 0; |
| 232 | vkEnumeratePhysicalDevices(instance, &deviceCount, nullptr); |
| 233 | |
| 234 | if (deviceCount == 0) { |
| 235 | throw std::runtime_error("failed to find GPUs with Vulkan support!"); |
| 236 | } |
| 237 | |
| 238 | std::vector<VkPhysicalDevice> devices(deviceCount); |
| 239 | vkEnumeratePhysicalDevices(instance, &deviceCount, devices.data()); |
| 240 | |
| 241 | for (const auto &device : devices) { |
| 242 | if (isDeviceSuitable(device)) { |
| 243 | physicalDevice = device; |
| 244 | break; |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | if (physicalDevice == VK_NULL_HANDLE) { |
| 249 | throw std::runtime_error("failed to find a suitable GPU!"); |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | void vkRenderer::createLogicalDevice() { |
| 254 | QueueFamilyIndices indices = findQueueFamilies(physicalDevice); |
nothing calls this directly
no outgoing calls
no test coverage detected