MCPcopy Create free account
hub / github.com/Overv/VulkanTutorial / HelloTriangleApplication

Class HelloTriangleApplication

code/07_image_views.cpp:63–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61};
62
63class HelloTriangleApplication {
64public:
65 void run() {
66 initWindow();
67 initVulkan();
68 mainLoop();
69 cleanup();
70 }
71
72private:
73 GLFWwindow* window;
74
75 VkInstance instance;
76 VkDebugUtilsMessengerEXT debugMessenger;
77 VkSurfaceKHR surface;
78
79 VkPhysicalDevice physicalDevice = VK_NULL_HANDLE;
80 VkDevice device;
81
82 VkQueue graphicsQueue;
83 VkQueue presentQueue;
84
85 VkSwapchainKHR swapChain;
86 std::vector<VkImage> swapChainImages;
87 VkFormat swapChainImageFormat;
88 VkExtent2D swapChainExtent;
89 std::vector<VkImageView> swapChainImageViews;
90
91 void initWindow() {
92 glfwInit();
93
94 glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
95 glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
96
97 window = glfwCreateWindow(WIDTH, HEIGHT, "Vulkan", nullptr, nullptr);
98 }
99
100 void initVulkan() {
101 createInstance();
102 setupDebugMessenger();
103 createSurface();
104 pickPhysicalDevice();
105 createLogicalDevice();
106 createSwapChain();
107 createImageViews();
108 }
109
110 void mainLoop() {
111 while (!glfwWindowShouldClose(window)) {
112 glfwPollEvents();
113 }
114 }
115
116 void cleanup() {
117 for (auto imageView : swapChainImageViews) {
118 vkDestroyImageView(device, imageView, nullptr);
119 }
120

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected