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

Class HelloTriangleApplication

code/16_frames_in_flight.cpp:66–901  ·  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 std::vector<VkCommandBuffer> commandBuffers;
101
102 std::vector<VkSemaphore> imageAvailableSemaphores;
103 std::vector<VkSemaphore> renderFinishedSemaphores;
104 std::vector<VkFence> inFlightFences;
105 uint32_t currentFrame = 0;
106
107 void initWindow() {
108 glfwInit();
109
110 glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
111 glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
112
113 window = glfwCreateWindow(WIDTH, HEIGHT, "Vulkan", nullptr, nullptr);
114 }
115
116 void initVulkan() {
117 createInstance();
118 setupDebugMessenger();
119 createSurface();
120 pickPhysicalDevice();
121 createLogicalDevice();
122 createSwapChain();
123 createImageViews();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected