Queue: Respect queueCount of Queue Family Properties
This commit is contained in:
parent
3749af2c5c
commit
d26695607b
1 changed files with 13 additions and 4 deletions
|
@ -35,25 +35,34 @@ public class QueueFamilyRequirementsValidator {
|
|||
|
||||
for (int i = 0; i < vkQueueFamilyProps.capacity(); i++) {
|
||||
var vkQueueFamilyProp = vkQueueFamilyProps.get(i);
|
||||
int availableQueue = vkQueueFamilyProp.queueCount();
|
||||
|
||||
if (hasRequiredFlag(VK10.VK_QUEUE_GRAPHICS_BIT) && queueFlagIsSupported(vkQueueFamilyProp)) {
|
||||
if (hasRequiredFlag(VK10.VK_QUEUE_GRAPHICS_BIT) && queueFlagIsSupported(vkQueueFamilyProp)
|
||||
&& availableQueue > 0) {
|
||||
queueFamilyIndicesBuilder.withGraphicsQueueFamilyIndex(i);
|
||||
requiredQueueFlags &= ~VK10.VK_QUEUE_GRAPHICS_BIT; // Consume the flag
|
||||
availableQueue--;
|
||||
}
|
||||
|
||||
if (hasRequiredFlag(VK10.VK_QUEUE_COMPUTE_BIT) && queueFlagIsSupported(vkQueueFamilyProp)) {
|
||||
if (hasRequiredFlag(VK10.VK_QUEUE_COMPUTE_BIT) && queueFlagIsSupported(vkQueueFamilyProp)
|
||||
&& availableQueue > 0) {
|
||||
queueFamilyIndicesBuilder.withComputeQueueFamilyIndex(i);
|
||||
requiredQueueFlags &= ~VK10.VK_QUEUE_COMPUTE_BIT; // Consume the flag
|
||||
availableQueue--;
|
||||
}
|
||||
|
||||
if (hasRequiredFlag(VK10.VK_QUEUE_TRANSFER_BIT) && queueFlagIsSupported(vkQueueFamilyProp)) {
|
||||
if (hasRequiredFlag(VK10.VK_QUEUE_TRANSFER_BIT) && queueFlagIsSupported(vkQueueFamilyProp)
|
||||
&& availableQueue > 0) {
|
||||
queueFamilyIndicesBuilder.withTransferQueueFamilyIndex(i);
|
||||
requiredQueueFlags &= ~VK10.VK_QUEUE_TRANSFER_BIT; // Consume the flag
|
||||
availableQueue--;
|
||||
}
|
||||
|
||||
if (surface.isPresent() && isSurfaceSupported(surface.get(), physicalDevice, i)) {
|
||||
if (surface.isPresent() && isSurfaceSupported(surface.get(), physicalDevice, i)
|
||||
&& availableQueue > 0) {
|
||||
queueFamilyIndicesBuilder.withPresentQueueFamilyIndex(i);
|
||||
surface = Optional.empty(); // Consume the surface
|
||||
availableQueue--;
|
||||
}
|
||||
|
||||
if (requiredQueueFlags == 0 && surface.isEmpty()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue