Skip to content

Commit

Permalink
Removes Vulkan devices that does not supports graphics operations (#995)
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon authored Sep 22, 2024
1 parent 038f4ce commit 57549f3
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,35 @@ int main(int argc, char *argv[])
"No any Vulkan device supports Vulkan 1.3.");
return 1;
}

// Filter out devices that does not support graphics operations.
erase_if(vkDevices, [](VkPhysicalDevice dev) {
// Get number of queue family.
uint32_t count;

vkFunctions->vkGetPhysicalDeviceQueueFamilyProperties(dev, &count, nullptr);

// Get queue family.
QList<VkQueueFamilyProperties> families(count);

vkFunctions->vkGetPhysicalDeviceQueueFamilyProperties(dev, &count, families.data());

for (auto &f : families) {
if (f.queueFlags & VK_QUEUE_GRAPHICS_BIT) {
return false;
}
}

return true;
});

if (vkDevices.isEmpty()) {
QMessageBox::critical(
nullptr,
"Error",
"No any Vulkan device supports graphics operations.");
return 1;
}
#endif

// Check if no any required settings.
Expand Down

0 comments on commit 57549f3

Please sign in to comment.