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

Class HelloTriangleApplication

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected