Skip to content

Commit

Permalink
Test MinimalQueueFamilyMapper with multiple windows
Browse files Browse the repository at this point in the history
  • Loading branch information
knokko committed Aug 20, 2024
1 parent ef5426a commit 1803419
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public QueueFamilyMapping mapQueueFamilies(

int graphicsIndex = -1;
int computeIndex = -1;
int[] presentIndices = new int[presentSupportMatrix[0].length]; // TODO Test multiple present indices
int[] presentIndices = new int[presentSupportMatrix[0].length];
Arrays.fill(presentIndices, -1);

for (int familyIndex = 0; familyIndex < queueFamilies.limit(); familyIndex++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,37 @@ public void testWithoutAnyVideoFamilies() {
}
}

// TODO Test with multiple windows
@Test
public void testWithMultipleWindows() {
try (var stack = stackPush()) {
var pQueueFamilies = VkQueueFamilyProperties.calloc(3, stack);
memPutInt(
pQueueFamilies.get(0).address() + VkQueueFamilyProperties.QUEUEFLAGS,
VK_QUEUE_VIDEO_ENCODE_BIT_KHR | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_TRANSFER_BIT
);
memPutInt(
pQueueFamilies.get(1).address() + VkQueueFamilyProperties.QUEUEFLAGS,
VK_QUEUE_TRANSFER_BIT
);
memPutInt(
pQueueFamilies.get(2).address() + VkQueueFamilyProperties.QUEUEFLAGS,
VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT
);

boolean[][] presentSupportMatrix = {
{ true, false, true },
{ true, true, true },
{ true, false, true }
};
var mapping = new MinimalQueueFamilyMapper().mapQueueFamilies(pQueueFamilies, new HashSet<>(), presentSupportMatrix);
assertEquals(2, mapping.graphics().index());
assertEquals(2, mapping.compute().index());
assertEquals(2, mapping.transfer().index());
assertNull(mapping.videoEncode());
assertNull(mapping.videoDecode());
assertEquals(2, mapping.presentFamilyIndices()[0]);
assertEquals(1, mapping.presentFamilyIndices()[1]);
assertEquals(2, mapping.presentFamilyIndices()[2]);
}
}
}

0 comments on commit 1803419

Please sign in to comment.