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

Method prepare

samples/api/hello_triangle/hello_triangle.cpp:1081–1111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1079}
1080
1081bool HelloTriangle::prepare(const vkb::ApplicationOptions &options)
1082{
1083 // Headless is not supported to keep this sample as simple as possible
1084 assert(options.window != nullptr);
1085 assert(options.window->get_window_mode() != vkb::Window::Mode::Headless);
1086
1087 init_instance();
1088
1089 context.surface = options.window->create_surface(context.instance, nullptr);
1090 auto &extent = options.window->get_extent();
1091 context.swapchain_dimensions.width = extent.width;
1092 context.swapchain_dimensions.height = extent.height;
1093
1094 if (!context.surface)
1095 {
1096 throw std::runtime_error("Failed to create window surface.");
1097 }
1098
1099 init_device();
1100
1101 init_vertex_buffer();
1102
1103 init_swapchain();
1104
1105 // Create the necessary objects for rendering.
1106 init_render_pass();
1107 init_pipeline();
1108 init_framebuffers();
1109
1110 return true;
1111}
1112
1113void HelloTriangle::update(float delta_time)
1114{

Callers

nothing calls this directly

Calls 2

get_window_modeMethod · 0.80
create_surfaceMethod · 0.45

Tested by

no test coverage detected