Fix API of CustomQueueDescription

This commit is contained in:
Nicholaus Clark 2023-10-07 18:17:16 -04:00 committed by Charles Giessen
parent d759d3d575
commit 834960e58f
3 changed files with 11 additions and 14 deletions

View File

@ -1437,10 +1437,8 @@ DispatchTable Device::make_table() const { return { device, fp_vkGetDeviceProcAd
Device::operator VkDevice() const { return this->device; }
CustomQueueDescription::CustomQueueDescription(uint32_t index, uint32_t count, std::vector<float> priorities)
: index(index), count(count), priorities(priorities) {
assert(count == priorities.size());
}
CustomQueueDescription::CustomQueueDescription(uint32_t index, std::vector<float> priorities)
: index(index), priorities(priorities) {}
void destroy_device(Device device) {
device.internal_table.fp_vkDestroyDevice(device.device, device.allocation_callbacks);
@ -1455,7 +1453,7 @@ Result<Device> DeviceBuilder::build() const {
if (queue_descriptions.size() == 0) {
for (uint32_t i = 0; i < physical_device.queue_families.size(); i++) {
queue_descriptions.push_back(CustomQueueDescription{ i, 1, std::vector<float>{ 1.0f } });
queue_descriptions.push_back(CustomQueueDescription{ i, std::vector<float>{ 1.0f } });
}
}
@ -1464,7 +1462,7 @@ Result<Device> DeviceBuilder::build() const {
VkDeviceQueueCreateInfo queue_create_info = {};
queue_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
queue_create_info.queueFamilyIndex = desc.index;
queue_create_info.queueCount = desc.count;
queue_create_info.queueCount = static_cast<std::uint32_t>(desc.priorities.size());
queue_create_info.pQueuePriorities = desc.priorities.data();
queueCreateInfos.push_back(queue_create_info);
}

View File

@ -719,9 +719,8 @@ struct Device {
// For advanced device queue setup
struct CustomQueueDescription {
explicit CustomQueueDescription(uint32_t index, uint32_t count, std::vector<float> priorities);
explicit CustomQueueDescription(uint32_t index, std::vector<float> priorities);
uint32_t index = 0;
uint32_t count = 0;
std::vector<float> priorities;
};

View File

@ -209,8 +209,8 @@ TEST_CASE("Device Configuration", "[VkBootstrap.bootstrap]") {
auto queue_families = phys_device.get_queue_families();
for (uint32_t i = 0; i < (uint32_t)queue_families.size(); i++) {
if (queue_families[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
queue_descriptions.push_back(vkb::CustomQueueDescription(
i, queue_families[i].queueCount, std::vector<float>(queue_families[i].queueCount, 1.0f)));
queue_descriptions.push_back(
vkb::CustomQueueDescription(i, std::vector<float>(queue_families[i].queueCount, 1.0f)));
}
}
if (phys_device.has_dedicated_compute_queue()) {
@ -218,15 +218,15 @@ TEST_CASE("Device Configuration", "[VkBootstrap.bootstrap]") {
if ((queue_families[i].queueFlags & VK_QUEUE_COMPUTE_BIT) &&
(queue_families[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) == 0 &&
(queue_families[i].queueFlags & VK_QUEUE_TRANSFER_BIT) == 0)
queue_descriptions.push_back(vkb::CustomQueueDescription(
i, queue_families[i].queueCount, std::vector<float>(queue_families[i].queueCount, 1.0f)));
queue_descriptions.push_back(
vkb::CustomQueueDescription(i, std::vector<float>(queue_families[i].queueCount, 1.0f)));
}
} else if (phys_device.has_separate_compute_queue()) {
for (uint32_t i = 0; i < (uint32_t)queue_families.size(); i++) {
if ((queue_families[i].queueFlags & VK_QUEUE_COMPUTE_BIT) &&
((queue_families[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) == 0)) {
queue_descriptions.push_back(vkb::CustomQueueDescription(
i, queue_families[i].queueCount, std::vector<float>(queue_families[i].queueCount, 1.0f)));
queue_descriptions.push_back(
vkb::CustomQueueDescription(i, std::vector<float>(queue_families[i].queueCount, 1.0f)));
}
}
}