Skip to content

Commit 7969663

Browse files
committed
checks if given family queue has compute capability
Signed-off-by: Matthias Möller <m_moeller@live.de>
1 parent ec7f816 commit 7969663

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/Manager.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,22 @@ Manager::createDevice(const std::vector<uint32_t>& familyQueueIndices,
398398

399399
this->mComputeQueueFamilyIndices.push_back(computeQueueFamilyIndex);
400400
} else {
401+
std::vector<vk::QueueFamilyProperties> allQueueFamilyProperties =
402+
physicalDevice.getQueueFamilyProperties();
403+
for (auto queueIndexGiven : familyQueueIndices) {
404+
if (queueIndexGiven >= allQueueFamilyProperties.size()) {
405+
throw std::runtime_error(
406+
"Given family queue index does not exists. Index given: " +
407+
std::to_string(queueIndexGiven));
408+
}
409+
if (!(allQueueFamilyProperties[queueIndexGiven].queueFlags &
410+
vk::QueueFlagBits::eCompute)) {
411+
throw std::runtime_error(
412+
"Given family queue index does not support compute "
413+
"operations. Index given: " +
414+
std::to_string(queueIndexGiven));
415+
}
416+
}
401417
this->mComputeQueueFamilyIndices = familyQueueIndices;
402418
}
403419

0 commit comments

Comments
 (0)