Changeset 3f32dfd in opengl-game for vulkan-game.hpp


Ignore:
Timestamp:
Jan 24, 2021, 5:56:07 PM (4 years ago)
Author:
Dmitry Portnoy <dportnoy@…>
Branches:
feature/imgui-sdl
Children:
ce9dc9f
Parents:
7f60b28
git-author:
Dmitry Portnoy <dportnoy@…> (01/24/21 17:47:00)
git-committer:
Dmitry Portnoy <dportnoy@…> (01/24/21 17:56:07)
Message:

In VulkanGame, use the rewritten functions for querting swap chain capabilities, and use a separate command pool for setting up image resources

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.hpp

    r7f60b28 r3f32dfd  
    198198class VulkanGame {
    199199   public:
    200       VulkanGame(int maxFramesInFlight);
     200      VulkanGame();
    201201      ~VulkanGame();
    202202
     
    234234         void* pUserData);
    235235
    236       // TODO: Make these consts static
    237       // Also, maybe move them into consts.hpp
    238 
    239       const int MAX_FRAMES_IN_FLIGHT;
    240 
    241236      const float NEAR_CLIP = 0.1f;
    242237      const float FAR_CLIP = 100.0f;
     
    268263      VkQueue presentQueue;
    269264
     265      // TODO: Maybe make a swapchain struct for convenience
     266      VkSurfaceFormatKHR swapChainSurfaceFormat;
     267      VkPresentModeKHR swapChainPresentMode;
     268      VkExtent2D swapChainExtent;
     269      uint32_t swapChainMinImageCount;
    270270      uint32_t swapChainImageCount;
    271271      VkSwapchainKHR swapChain;
    272272      vector<VkImage> swapChainImages;
    273       VkFormat swapChainImageFormat;
    274       VkExtent2D swapChainExtent;
    275273      vector<VkImageView> swapChainImageViews;
    276274      vector<VkFramebuffer> swapChainFramebuffers;
    277275
    278276      VkRenderPass renderPass;
     277
     278      VkCommandPool resourceCommandPool;
     279
    279280      VkCommandPool commandPool;
     281      vector<VkCommandPool> commandPools; // This is not used yet, but will be once
    280282      vector<VkCommandBuffer> commandBuffers;
    281283
    282284      VulkanImage depthImage;
    283285
    284       vector<VkSemaphore> imageAvailableSemaphores;
    285       vector<VkSemaphore> renderFinishedSemaphores;
     286      // These are per frame
     287      vector<VkSemaphore> imageAcquiredSemaphores;
     288      vector<VkSemaphore> renderCompleteSemaphores;
     289
     290      // These are per swap chain image
    286291      vector<VkFence> inFlightFences;
    287292
    288       size_t currentFrame;
     293      uint32_t imageIndex;
     294      uint32_t currentFrame;
    289295
    290296      bool framebufferResized;
     
    380386      void initMatrices();
    381387      void mainLoop();
    382       void updateScene(uint32_t currentImage);
     388      void updateScene();
    383389      void renderScene();
    384390      void cleanup();
     
    392398      void createLogicalDevice(const vector<const char*>& validationLayers,
    393399         const vector<const char*>& deviceExtensions);
     400      void chooseSwapChainProperties();
    394401      void createSwapChain();
    395402      void createImageViews();
    396403      void createRenderPass();
    397       VkFormat findDepthFormat();
     404      VkFormat findDepthFormat(); // TODO: Declare/define (in the cpp file) this function in some util functions section
     405      void createResourceCommandPool();
    398406      void createCommandPool();
    399407      void createImageResources();
    400 
    401       void createTextureSampler();
    402408      void createFramebuffers();
    403409      void createCommandBuffers();
    404410      void createSyncObjects();
     411
     412      void createTextureSampler();
    405413
    406414      void createImguiDescriptorPool();
Note: See TracChangeset for help on using the changeset viewer.