Changeset f94eea9 in opengl-game for vulkan-game.cpp


Ignore:
Timestamp:
Sep 27, 2019, 7:20:55 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
6fc24c7
Parents:
054d9ed
Message:

In vulkangame, add code to create image views

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.cpp

    r054d9ed rf94eea9  
    101101   createLogicalDevice(validationLayers, deviceExtensions);
    102102   createSwapChain();
     103   createImageViews();
    103104}
    104105
     
    175176   gui->shutdown();
    176177   delete gui;
    177 }
    178 
    179 void VulkanGame::cleanupSwapChain() {
    180    vkDestroySwapchainKHR(device, swapChain, nullptr);
    181178}
    182179
     
    389386      createInfo.queueFamilyIndexCount = 2;
    390387      createInfo.pQueueFamilyIndices = queueFamilyIndices;
    391    }
    392    else {
     388   } else {
    393389      createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
    394390      createInfo.queueFamilyIndexCount = 0;
     
    413409   swapChainExtent = extent;
    414410}
     411
     412void VulkanGame::createImageViews() {
     413   swapChainImageViews.resize(swapChainImages.size());
     414
     415   for (size_t i = 0; i < swapChainImages.size(); i++) {
     416      swapChainImageViews[i] = VulkanUtils::createImageView(device, swapChainImages[i], swapChainImageFormat,
     417         VK_IMAGE_ASPECT_COLOR_BIT);
     418   }
     419}
     420
     421void VulkanGame::cleanupSwapChain() {
     422   for (auto imageView : swapChainImageViews) {
     423      vkDestroyImageView(device, imageView, nullptr);
     424   }
     425
     426   vkDestroySwapchainKHR(device, swapChain, nullptr);
     427}
Note: See TracChangeset for help on using the changeset viewer.