MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / prepare

Method prepare

samples/api/hpp_hello_triangle/hpp_hello_triangle.cpp:154–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154bool HPPHelloTriangle::prepare(const vkb::ApplicationOptions &options)
155{
156 // Headless is not supported to keep this sample as simple as possible
157 assert(options.window != nullptr);
158 assert(options.window->get_window_mode() != vkb::Window::Mode::Headless);
159
160 if (Application::prepare(options))
161 {
162 instance = create_instance({VK_KHR_SURFACE_EXTENSION_NAME}, {});
163#if defined(VKB_DEBUG) || defined(VKB_VALIDATION_LAYERS)
164 debug_utils_messenger = instance.createDebugUtilsMessengerEXT(debug_utils_create_info);
165#endif
166
167 select_physical_device_and_surface();
168
169 const vkb::Window::Extent &extent = options.window->get_extent();
170 swapchain_data.extent.width = extent.width;
171 swapchain_data.extent.height = extent.height;
172
173 // create a device
174 device = create_device({VK_KHR_SWAPCHAIN_EXTENSION_NAME});
175
176 // get the (graphics) queue
177 queue = device.getQueue(graphics_queue_index, 0);
178
179 vma_allocator = create_vma_allocator();
180 std::tie(vertex_buffer, vertex_buffer_allocation) = create_vertex_buffer();
181
182 init_swapchain();
183
184 // Create the necessary objects for rendering.
185 render_pass = create_render_pass();
186
187 // Create a blank pipeline layout.
188 // We are not binding any resources to the pipeline in this first sample.
189 pipeline_layout = device.createPipelineLayout({});
190
191 pipeline = create_graphics_pipeline();
192
193 init_framebuffers();
194 }
195
196 return true;
197}
198
199void HPPHelloTriangle::update(float delta_time)
200{

Callers

nothing calls this directly

Calls 2

create_graphics_pipelineFunction · 0.85
get_window_modeMethod · 0.80

Tested by

no test coverage detected