Changeset fa9fa1c in opengl-game for vulkan-game.cpp
- Timestamp:
- Sep 27, 2019, 8:53:27 PM (6 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 7563b8a, a0da009
- Parents:
- 0e09340
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.cpp
r0e09340 rfa9fa1c 104 104 createImageViews(); 105 105 createRenderPass(); 106 createCommandPool(); 106 107 } 107 108 … … 167 168 cleanupSwapChain(); 168 169 170 vkDestroyCommandPool(device, commandPool, nullptr); 169 171 vkDestroyDevice(device, nullptr); 170 172 vkDestroySurfaceKHR(instance, surface, nullptr); … … 293 295 } 294 296 295 bool VulkanGame::isDeviceSuitable(VkPhysicalDevice device, const vector<const char*>& deviceExtensions) { 297 bool VulkanGame::isDeviceSuitable(VkPhysicalDevice physicalDevice, 298 const vector<const char*>& deviceExtensions) { 296 299 VkPhysicalDeviceProperties deviceProperties; 297 vkGetPhysicalDeviceProperties( device, &deviceProperties);300 vkGetPhysicalDeviceProperties(physicalDevice, &deviceProperties); 298 301 299 302 cout << "Device: " << deviceProperties.deviceName << endl; 300 303 301 QueueFamilyIndices indices = VulkanUtils::findQueueFamilies( device, surface);302 bool extensionsSupported = VulkanUtils::checkDeviceExtensionSupport( device, deviceExtensions);304 QueueFamilyIndices indices = VulkanUtils::findQueueFamilies(physicalDevice, surface); 305 bool extensionsSupported = VulkanUtils::checkDeviceExtensionSupport(physicalDevice, deviceExtensions); 303 306 bool swapChainAdequate = false; 304 307 305 308 if (extensionsSupported) { 306 SwapChainSupportDetails swapChainSupport = VulkanUtils::querySwapChainSupport( device, surface);309 SwapChainSupportDetails swapChainSupport = VulkanUtils::querySwapChainSupport(physicalDevice, surface); 307 310 swapChainAdequate = !swapChainSupport.formats.empty() && !swapChainSupport.presentModes.empty(); 308 311 } 309 312 310 313 VkPhysicalDeviceFeatures supportedFeatures; 311 vkGetPhysicalDeviceFeatures( device, &supportedFeatures);314 vkGetPhysicalDeviceFeatures(physicalDevice, &supportedFeatures); 312 315 313 316 return indices.isComplete() && extensionsSupported && swapChainAdequate && supportedFeatures.samplerAnisotropy; … … 492 495 } 493 496 497 void VulkanGame::createCommandPool() { 498 QueueFamilyIndices queueFamilyIndices = VulkanUtils::findQueueFamilies(physicalDevice, surface);; 499 500 VkCommandPoolCreateInfo poolInfo = {}; 501 poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; 502 poolInfo.queueFamilyIndex = queueFamilyIndices.graphicsFamily.value(); 503 poolInfo.flags = 0; 504 505 if (vkCreateCommandPool(device, &poolInfo, nullptr, &commandPool) != VK_SUCCESS) { 506 throw runtime_error("failed to create graphics command pool!"); 507 } 508 } 509 494 510 void VulkanGame::cleanupSwapChain() { 495 511 vkDestroyRenderPass(device, renderPass, nullptr);
Note:
See TracChangeset
for help on using the changeset viewer.