tests: Add queue family selection utility
Add additional queue family selection utility for choosing queue
families based on both required and restricted capabilities. Refactored
existing utility to use new utility.
Change-Id: I3c92cfdbbe6463bf1730f2173e91424e082063ce
diff --git a/tests/vkrenderframework.cpp b/tests/vkrenderframework.cpp
index 817d649..fc84224 100644
--- a/tests/vkrenderframework.cpp
+++ b/tests/vkrenderframework.cpp
@@ -508,10 +508,12 @@
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;
}
}