Changeset 6a39266 in opengl-game for vulkan-utils.cpp


Ignore:
Timestamp:
Jan 3, 2021, 6:29:50 PM (3 years ago)
Author:
Dmitry Portnoy <dportnoy@…>
Branches:
feature/imgui-sdl
Children:
7f60b28
Parents:
6493e43
git-author:
Dmitry Portnoy <dportnoy@…> (01/03/21 18:25:46)
git-committer:
Dmitry Portnoy <dportnoy@…> (01/03/21 18:29:50)
Message:

In vulkan-game, throw an error if either a graphics or present queue could not be found

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-utils.cpp

    r6493e43 r6a39266  
    6060}
    6161
     62// TODO: Change this to prefer one queue that supports both graphics and presentation
    6263QueueFamilyIndices VulkanUtils::findQueueFamilies(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface) {
    6364   QueueFamilyIndices indices;
     
    7172   int i = 0;
    7273   for (const auto& queueFamily : queueFamilies) {
    73       if (queueFamily.queueCount > 0 && queueFamily.queueFlags & VK_QUEUE_GRAPHICS_BIT) {
    74          indices.graphicsFamily = i;
    75       }
    76 
    77       VkBool32 presentSupport = false;
    78       vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice, i, surface, &presentSupport);
    79 
    80       if (queueFamily.queueCount > 0 && presentSupport) {
    81          indices.presentFamily = i;
    82       }
    83 
    84       if (indices.isComplete()) {
    85          break;
     74      if (queueFamily.queueCount > 0) {
     75         if (queueFamily.queueFlags & VK_QUEUE_GRAPHICS_BIT) {
     76            indices.graphicsFamily = i;
     77         }
     78
     79         VkBool32 presentSupport = false;
     80         vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice, i, surface, &presentSupport);
     81
     82         if (presentSupport) {
     83            indices.presentFamily = i;
     84         }
     85
     86         if (indices.isComplete()) {
     87            break;
     88         }
    8689      }
    8790
Note: See TracChangeset for help on using the changeset viewer.