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

Class HelloTriangleApplication

code/15_hello_triangle.cpp:66–889  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected