From 517c4504c624d62bf8e73aee63c2f24e28917ce4 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 29 Sep 2018 21:20:58 -0400 Subject: [PATCH] Properly set queue family indices --- src/renderer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/renderer.cpp b/src/renderer.cpp index 6249073..076074a 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -156,17 +156,17 @@ void Renderer::createLogicalDevice() { VkQueueFamilyProperties* queueFamilyProperties = new VkQueueFamilyProperties[queueFamilyPropertiesCount]; vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice_, &queueFamilyPropertiesCount, queueFamilyProperties); - - uint32_t graphicsFamilyIndex = 0; - + for(uint32_t i = 0; i < queueFamilyPropertiesCount; i++) { if(queueFamilyProperties[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) - graphicsFamilyIndex = i; + queueIndices.graphics = i; } delete[] queueFamilyProperties; - const std::set queueFamilyIndices = {graphicsFamilyIndex}; + queueIndices.presentation = queueIndices.graphics; //FIXME: this may not always be true!! + + const std::set queueFamilyIndices = {queueIndices.graphics}; std::vector deviceQueueCreateInfos; for(auto queueFamilyIndex : queueFamilyIndices) { const float priority = 1.0f; @@ -191,5 +191,5 @@ void Renderer::createLogicalDevice() { vkCreateDevice(physicalDevice_, &deviceCreateInfo, nullptr, &device_); - vkGetDeviceQueue(device_, graphicsFamilyIndex, 0, &graphicsQueue_); + vkGetDeviceQueue(device_, queueIndices.graphics, 0, &graphicsQueue_); }