diff --git a/projects/first_mesh/src/main.cpp b/projects/first_mesh/src/main.cpp index 480ec2a30f4a44911230ed12baac27021d50b846..ae90e6d3949df8e1d3a006a295bf871048f685b5 100644 --- a/projects/first_mesh/src/main.cpp +++ b/projects/first_mesh/src/main.cpp @@ -25,7 +25,7 @@ int main(int argc, const char** argv) { window, applicationName, VK_MAKE_VERSION(0, 0, 1), - { vk::QueueFlagBits::eGraphics }, //at this place I now must remove the other queues for the app to work but probably there is a better way to handle this + { vk::QueueFlagBits::eGraphics ,vk::QueueFlagBits::eCompute , vk::QueueFlagBits::eTransfer }, {}, { "VK_KHR_swapchain" } ); diff --git a/src/vkcv/CommandResources.cpp b/src/vkcv/CommandResources.cpp index 7a08c366abeafd2af72d433e288124c9aeaefeb7..71c990c3c222f2318c2f5744ff6295f667d9e6f8 100644 --- a/src/vkcv/CommandResources.cpp +++ b/src/vkcv/CommandResources.cpp @@ -55,14 +55,8 @@ namespace vkcv { else if (type == QueueType::Compute) { return queueManager.getComputeQueues().front(); } - //example of how the non-existence of queues other than the graphics queue could be handled else if (type == QueueType::Transfer) { - if (queueManager.getTransferQueues().size() == 0) { - return queueManager.getGraphicsQueues().front(); - } - else { - return queueManager.getTransferQueues().front(); - } + return queueManager.getTransferQueues().front(); } else if (type == QueueType::Present) { return queueManager.getPresentQueue(); diff --git a/src/vkcv/QueueManager.cpp b/src/vkcv/QueueManager.cpp index c062437553c4c49d72f6d9a4f1160da2e5d41884..25243546782ca94dbc9f9a4907fb822a317d41f3 100644 --- a/src/vkcv/QueueManager.cpp +++ b/src/vkcv/QueueManager.cpp @@ -4,7 +4,6 @@ #include "vkcv/QueueManager.hpp" -#include "vkcv/QueueManager.hpp" namespace vkcv { @@ -89,7 +88,12 @@ namespace vkcv { } } if (!found) { - throw std::runtime_error("Too many graphics queues were requested than being available!"); + for (int i = 0; i < queueFamilyStatus.size() && !found; i++) { + if (initialQueueFamilyStatus[i][0] > 0) { + queuePairsGraphics.push_back(std::pair(i, 0)); + found = true; + } + } } break; case vk::QueueFlagBits::eCompute: @@ -104,7 +108,12 @@ namespace vkcv { } } if (!found) { - throw std::runtime_error("Too many compute queues were requested than being available!"); + for (int i = 0; i < queueFamilyStatus.size() && !found; i++) { + if (initialQueueFamilyStatus[i][1] > 0) { + queuePairsCompute.push_back(std::pair(i, 0)); + found = true; + } + } } break; case vk::QueueFlagBits::eTransfer: @@ -119,7 +128,12 @@ namespace vkcv { } } if (!found) { - throw std::runtime_error("Too many transfer queues were requested than being available!"); + for (int i = 0; i < queueFamilyStatus.size() && !found; i++) { + if (initialQueueFamilyStatus[i][2] > 0) { + queuePairsTransfer.push_back(std::pair(i, 0)); + found = true; + } + } } break; default: