queue_props = phy().queue_properties();
}
-uint32_t VkDeviceObj::QueueFamilyWithoutCapabilities(VkQueueFlags capabilities) {
- // Find a queue family without desired capabilities
+uint32_t VkDeviceObj::QueueFamilyMatching(VkQueueFlags with, VkQueueFlags without, bool all_bits) {
+ // Find a queue family with and without desired capabilities
for (uint32_t i = 0; i < queue_props.size(); i++) {
- if ((queue_props[i].queueFlags & capabilities) == 0 && (queue_props[i].queueCount > 0)) {
+ auto flags = queue_props[i].queueFlags;
+ bool matches = all_bits ? (flags & with) == with : (flags & with) != 0;
+ if (matches && ((flags & without) == 0) && (queue_props[i].queueCount > 0)) {
return i;
}
}
VkDeviceObj(uint32_t id, VkPhysicalDevice obj, std::vector<const char *> &extension_names,
VkPhysicalDeviceFeatures *features = nullptr);
- uint32_t QueueFamilyWithoutCapabilities(VkQueueFlags capabilities);
+ uint32_t QueueFamilyMatching(VkQueueFlags with, VkQueueFlags without, bool all_bits = true);
+ uint32_t QueueFamilyWithoutCapabilities(VkQueueFlags capabilities) {
+ // an all_bits match with 0 matches all
+ return QueueFamilyMatching(VkQueueFlags(0), capabilities, true /* all_bits with */);
+ }
VkDevice device() { return handle(); }
void get_device_queue();