source: opengl-game/vulkan-game.hpp@ f94eea9

feature/imgui-sdl points-test
Last change on this file since f94eea9 was f94eea9, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 years ago

In vulkangame, add code to create image views

  • Property mode set to 100644
File size: 2.0 KB
Line 
1#ifndef _VULKAN_GAME_H
2#define _VULKAN_GAME_H
3
4#include "game-gui-sdl.hpp"
5
6#ifdef NDEBUG
7 const bool ENABLE_VALIDATION_LAYERS = false;
8#else
9 const bool ENABLE_VALIDATION_LAYERS = true;
10#endif
11
12class VulkanGame {
13 public:
14 VulkanGame();
15 ~VulkanGame();
16
17 void run(int width, int height, unsigned char guiFlags);
18
19 private:
20 GameGui* gui;
21
22 SDL_version sdlVersion;
23 SDL_Window* window;
24 SDL_Renderer* renderer;
25
26 VkInstance instance;
27 VkDebugUtilsMessengerEXT debugMessenger;
28 VkSurfaceKHR surface; // TODO: Change the variable name to vulkanSurface
29 VkPhysicalDevice physicalDevice = VK_NULL_HANDLE;
30 VkDevice device;
31
32 VkQueue graphicsQueue;
33 VkQueue presentQueue;
34
35 VkSwapchainKHR swapChain;
36 vector<VkImage> swapChainImages;
37 VkFormat swapChainImageFormat;
38 VkExtent2D swapChainExtent;
39 vector<VkImageView> swapChainImageViews;
40
41 bool initWindow(int width, int height, unsigned char guiFlags);
42 void initVulkan();
43 void mainLoop();
44 void renderUI();
45 void renderScene();
46 void cleanup();
47
48 void createVulkanInstance(const vector<const char*> &validationLayers);
49 void setupDebugMessenger();
50 void populateDebugMessengerCreateInfo(VkDebugUtilsMessengerCreateInfoEXT& createInfo);
51 void createVulkanSurface();
52 void pickPhysicalDevice(const vector<const char*>& deviceExtensions);
53 bool isDeviceSuitable(VkPhysicalDevice device, const vector<const char*>& deviceExtensions);
54 void createLogicalDevice(
55 const vector<const char*> validationLayers,
56 const vector<const char*>& deviceExtensions);
57 void createSwapChain();
58 void createImageViews();
59
60 void cleanupSwapChain();
61
62 static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(
63 VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
64 VkDebugUtilsMessageTypeFlagsEXT messageType,
65 const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,
66 void* pUserData);
67};
68
69#endif // _VULKAN_GAME_H
Note: See TracBrowser for help on using the repository browser.