Skip to content
Snippets Groups Projects

Resolve "Pipeline State Object"

Merged Mark Oliver Mints requested to merge 11-pipeline-state-object into develop
1 file
+ 15
18
Compare changes
  • Side-by-side
  • Inline
  • 61df58fc
    [#16][Fix] Fix queue creation · 61df58fc
    Vanessa Karolek authored
    If you specify Compute and Transfer as QueueFlagBits in main.cpp, I get the error telling I create more queues than being available for this queue family. The error is caused by wrong indexing in line 111. My device holds 3 queue families and Compute and Transfer operations are only supported by queue family #0 and #2, but we indexed #1 since we push queue family candidates into a vector structure. Thus, queue family #1 is ignored and queue family #2 is not indexed. Therefore, the queue family candidates vector is unnecessary and just causing trouble.
+ 15
18
@@ -94,32 +94,29 @@ namespace vkcv
{
std::vector<vk::DeviceQueueCreateInfo> queueCreateInfos;
std::vector<vk::QueueFamilyProperties> qFamilyProperties = physicalDevice.getQueueFamilyProperties();
std::vector<vk::QueueFamilyProperties> qFamilyCandidates;
// search for queue families which support the desired queue flag bits
for (auto& qFamily : qFamilyProperties) {
uint32_t create = queueCount;
for (int i = 0; i < qFamilyProperties.size(); i++) {
bool supported = true;
for (auto qFlag : queueFlags) {
supported = supported && (static_cast<uint32_t>(qFlag & qFamily.queueFlags) != 0);
supported = supported && (static_cast<uint32_t>(qFlag & qFamilyProperties[i].queueFlags) != 0);
}
if (supported) {
qFamilyCandidates.push_back(qFamily);
// if queue family supports all desired queue flag bits, create as many queues available for the actual queue family
// search for another queue family, if more queues should be created
if (supported && create > 0) {
const uint32_t maxCreatableQueues = std::min(create, qFamilyProperties[i].queueCount);
vk::DeviceQueueCreateInfo qCreateInfo(
vk::DeviceQueueCreateFlags(),
i,
maxCreatableQueues,
qPriorities.data()
);
queueCreateInfos.push_back(qCreateInfo);
create -= maxCreatableQueues;
}
}
uint32_t create = queueCount;
for (uint32_t i = 0; i < qFamilyCandidates.size() && create > 0; i++) {
const uint32_t maxCreatableQueues = std::min(create, qFamilyCandidates[i].queueCount);
vk::DeviceQueueCreateInfo qCreateInfo(
vk::DeviceQueueCreateFlags(),
i,
maxCreatableQueues,
qPriorities.data()
);
queueCreateInfos.push_back(qCreateInfo);
create -= maxCreatableQueues;
}
return queueCreateInfos;
}
Loading