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

Class HelloTriangleApplication

code/11_render_passes.cpp:64–675  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected