Skip to content
Snippets Groups Projects
Commit f2ce0b99 authored by Alexander Gauggel's avatar Alexander Gauggel
Browse files

[#18]Fix dead pointers in queue device create infi

parent 4d941484
No related branches found
No related tags found
1 merge request!12Resolve "Swapchain Class"
Pipeline #24804 passed
...@@ -21,6 +21,7 @@ namespace vkcv { ...@@ -21,6 +21,7 @@ namespace vkcv {
QueueFamilyIndices getQueueFamilyIndices(const vk::PhysicalDevice& physicalDevice, const vk::SurfaceKHR surface); QueueFamilyIndices getQueueFamilyIndices(const vk::PhysicalDevice& physicalDevice, const vk::SurfaceKHR surface);
// TODO: try to use specialised queues // TODO: try to use specialised queues
std::vector<vk::DeviceQueueCreateInfo> createDeviceQueueCreateInfo(const QueueFamilyIndices& indices); std::vector<vk::DeviceQueueCreateInfo> createDeviceQueueCreateInfo(const QueueFamilyIndices& indices,
std::vector<float> *outQueuePriorities);
} }
...@@ -202,7 +202,8 @@ namespace vkcv ...@@ -202,7 +202,8 @@ namespace vkcv
const vk::SurfaceKHR surface = createSurface(window.getWindow(), instance, physicalDevice); const vk::SurfaceKHR surface = createSurface(window.getWindow(), instance, physicalDevice);
const QueueFamilyIndices queueFamilyIndices = getQueueFamilyIndices(physicalDevice, surface); const QueueFamilyIndices queueFamilyIndices = getQueueFamilyIndices(physicalDevice, surface);
const std::vector<vk::DeviceQueueCreateInfo> qCreateInfos = createDeviceQueueCreateInfo(queueFamilyIndices); std::vector<float> queuePriorities;
const std::vector<vk::DeviceQueueCreateInfo> qCreateInfos = createDeviceQueueCreateInfo(queueFamilyIndices, &queuePriorities);
vk::DeviceCreateInfo deviceCreateInfo( vk::DeviceCreateInfo deviceCreateInfo(
vk::DeviceCreateFlags(), vk::DeviceCreateFlags(),
......
...@@ -45,7 +45,8 @@ namespace vkcv { ...@@ -45,7 +45,8 @@ namespace vkcv {
return indices; return indices;
} }
std::vector<vk::DeviceQueueCreateInfo> createDeviceQueueCreateInfo(const QueueFamilyIndices& indices) { std::vector<vk::DeviceQueueCreateInfo> createDeviceQueueCreateInfo(const QueueFamilyIndices& indices,
std::vector<float>* outQueuePriorities) {
// use set to avoid duplicate queues // use set to avoid duplicate queues
std::unordered_set<int> familyIndexSet; std::unordered_set<int> familyIndexSet;
...@@ -55,12 +56,16 @@ namespace vkcv { ...@@ -55,12 +56,16 @@ namespace vkcv {
familyIndexSet.insert(indices.presentIndex); familyIndexSet.insert(indices.presentIndex);
const vk::DeviceQueueCreateFlagBits flags = {}; const vk::DeviceQueueCreateFlagBits flags = {};
const float priority = 1.f;
std::vector<vk::DeviceQueueCreateInfo> createInfos; std::vector<vk::DeviceQueueCreateInfo> createInfos;
outQueuePriorities->resize(familyIndexSet.size(), 1.f);
int priorityIndex = 0;
for (const auto index : familyIndexSet) { for (const auto index : familyIndexSet) {
const vk::DeviceQueueCreateInfo graphicsCreateInfo(flags, index, 1, &priority); outQueuePriorities->push_back(1.f);
const vk::DeviceQueueCreateInfo graphicsCreateInfo(flags, index, 1, &outQueuePriorities->at(priorityIndex));
createInfos.push_back(graphicsCreateInfo); createInfos.push_back(graphicsCreateInfo);
priorityIndex++;
} }
return createInfos; return createInfos;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment