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

Class HelloTriangleApplication

code/12_graphics_pipeline_complete.cpp:64–697  ·  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 VkPipeline graphicsPipeline;
95
96 void initWindow() {
97 glfwInit();
98
99 glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
100 glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
101
102 window = glfwCreateWindow(WIDTH, HEIGHT, "Vulkan", nullptr, nullptr);
103 }
104
105 void initVulkan() {
106 createInstance();
107 setupDebugMessenger();
108 createSurface();
109 pickPhysicalDevice();
110 createLogicalDevice();
111 createSwapChain();
112 createImageViews();
113 createRenderPass();
114 createGraphicsPipeline();
115 }
116
117 void mainLoop() {
118 while (!glfwWindowShouldClose(window)) {
119 glfwPollEvents();
120 }
121 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected