Changeset 6a39266 in opengl-game
- Timestamp:
- Jan 3, 2021, 6:29:50 PM (4 years ago)
- 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)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.cpp
r6493e43 r6a39266 1 1 #include "vulkan-game.hpp" 2 3 #include "IMGUI/imgui_impl_sdl.h"4 #include "IMGUI/imgui_impl_vulkan.h"5 2 6 3 #include <array> … … 9 6 #include <set> 10 7 #include <stdexcept> 8 9 #include "IMGUI/imgui_impl_sdl.h" 10 #include "IMGUI/imgui_impl_vulkan.h" 11 11 12 12 #include "logger.hpp" … … 1368 1368 } 1369 1369 1370 bool VulkanGame::isDeviceSuitable(VkPhysicalDevice physicalDevice, 1371 const vector<const char*>& deviceExtensions) { 1370 bool VulkanGame::isDeviceSuitable(VkPhysicalDevice physicalDevice, const vector<const char*>& deviceExtensions) { 1372 1371 VkPhysicalDeviceProperties deviceProperties; 1373 1372 vkGetPhysicalDeviceProperties(physicalDevice, &deviceProperties); … … 1393 1392 const vector<const char*>& deviceExtensions) { 1394 1393 QueueFamilyIndices indices = VulkanUtils::findQueueFamilies(physicalDevice, surface); 1394 1395 if (!indices.isComplete()) { 1396 throw runtime_error("failed to find required queue families!"); 1397 } 1398 1399 // TODO: Using separate graphics and present queues currently works, but I should verify that I'm 1400 // using them correctly to get the most benefit out of separate queues 1395 1401 1396 1402 vector<VkDeviceQueueCreateInfo> queueCreateInfoList; … … 1401 1407 VkDeviceQueueCreateInfo queueCreateInfo = {}; 1402 1408 queueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO; 1409 queueCreateInfo.queueCount = 1; 1403 1410 queueCreateInfo.queueFamilyIndex = queueFamily; 1404 queueCreateInfo.queueCount = 1;1405 1411 queueCreateInfo.pQueuePriorities = &queuePriority; 1406 1412 -
vulkan-utils.cpp
r6493e43 r6a39266 60 60 } 61 61 62 // TODO: Change this to prefer one queue that supports both graphics and presentation 62 63 QueueFamilyIndices VulkanUtils::findQueueFamilies(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface) { 63 64 QueueFamilyIndices indices; … … 71 72 int i = 0; 72 73 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 } 86 89 } 87 90
Note:
See TracChangeset
for help on using the changeset viewer.