[Vulkan] Fix queue priorites going out of scope prematurely

This commit is contained in:
DrChat 2017-12-21 12:16:22 -06:00
parent c6ce4990fd
commit ad118fa842
1 changed files with 5 additions and 5 deletions

View File

@ -145,7 +145,9 @@ bool VulkanDevice::Initialize(DeviceInfo device_info) {
} }
std::vector<VkDeviceQueueCreateInfo> queue_infos; std::vector<VkDeviceQueueCreateInfo> queue_infos;
std::vector<std::vector<float>> queue_priorities;
queue_infos.resize(device_info.queue_family_properties.size()); queue_infos.resize(device_info.queue_family_properties.size());
queue_priorities.resize(queue_infos.size());
for (int i = 0; i < queue_infos.size(); i++) { for (int i = 0; i < queue_infos.size(); i++) {
VkDeviceQueueCreateInfo& queue_info = queue_infos[i]; VkDeviceQueueCreateInfo& queue_info = queue_infos[i];
VkQueueFamilyProperties& family_props = VkQueueFamilyProperties& family_props =
@ -157,15 +159,13 @@ bool VulkanDevice::Initialize(DeviceInfo device_info) {
queue_info.queueFamilyIndex = i; queue_info.queueFamilyIndex = i;
queue_info.queueCount = family_props.queueCount; queue_info.queueCount = family_props.queueCount;
std::vector<float> queue_priorities(queue_count); queue_priorities[i].resize(queue_count, 0.f);
if (i == ideal_queue_family_index) { if (i == ideal_queue_family_index) {
// Prioritize the first queue on the primary queue family. // Prioritize the first queue on the primary queue family.
queue_priorities[0] = 1.0f; queue_priorities[i][0] = 1.0f;
} else {
queue_priorities[0] = 0.f;
} }
queue_info.pQueuePriorities = queue_priorities.data(); queue_info.pQueuePriorities = queue_priorities[i].data();
} }
VkDeviceCreateInfo create_info; VkDeviceCreateInfo create_info;