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

Class HelloTriangleApplication

code/14_command_buffers.cpp:64–804  ·  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 VkCommandPool commandPool;
98 VkCommandBuffer commandBuffer;
99
100 void initWindow() {
101 glfwInit();
102
103 glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
104 glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
105
106 window = glfwCreateWindow(WIDTH, HEIGHT, "Vulkan", nullptr, nullptr);
107 }
108
109 void initVulkan() {
110 createInstance();
111 setupDebugMessenger();
112 createSurface();
113 pickPhysicalDevice();
114 createLogicalDevice();
115 createSwapChain();
116 createImageViews();
117 createRenderPass();
118 createGraphicsPipeline();
119 createFramebuffers();
120 createCommandPool();
121 createCommandBuffer();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected