source: opengl-game/vulkan-game.hpp@ 90a424f

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

In vulkangame, add code to create a Vulkan surface and pick a physical device

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[99d44b2]1#ifndef _VULKAN_GAME_H
2#define _VULKAN_GAME_H
[e8ebc76]3
[0df3c9a]4#include "game-gui-sdl.hpp"
5
[2e77b3f]6#ifdef NDEBUG
7 const bool ENABLE_VALIDATION_LAYERS = false;
8#else
9 const bool ENABLE_VALIDATION_LAYERS = true;
10#endif
11
[99d44b2]12class VulkanGame {
[e8ebc76]13 public:
[99d44b2]14 VulkanGame();
15 ~VulkanGame();
[0df3c9a]16
[b6e60b4]17 void run(int width, int height, unsigned char guiFlags);
[0df3c9a]18
19 private:
20 GameGui* gui;
[c559904]21
22 SDL_version sdlVersion;
[0df3c9a]23 SDL_Window* window;
[c1d9b2a]24 SDL_Renderer* renderer;
25
26 VkInstance instance;
27 VkDebugUtilsMessengerEXT debugMessenger;
[90a424f]28 VkSurfaceKHR surface;
29 VkPhysicalDevice physicalDevice = VK_NULL_HANDLE;
[0df3c9a]30
[b6e60b4]31 bool initWindow(int width, int height, unsigned char guiFlags);
[0df3c9a]32 void initVulkan();
33 void mainLoop();
34 void cleanup();
[c1d9b2a]35
36 void createVulkanInstance(const vector<const char*> &validationLayers);
37 void setupDebugMessenger();
38 void populateDebugMessengerCreateInfo(VkDebugUtilsMessengerCreateInfoEXT& createInfo);
[90a424f]39 void createVulkanSurface();
40 void pickPhysicalDevice();
41 bool isDeviceSuitable(VkPhysicalDevice device);
[c1d9b2a]42
43 static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(
44 VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
45 VkDebugUtilsMessageTypeFlagsEXT messageType,
46 const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,
47 void* pUserData);
[e8ebc76]48};
49
[99d44b2]50#endif // _VULKAN_GAME_H
Note: See TracBrowser for help on using the repository browser.