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

Method prepare

cube/cube.cpp:2148–2203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2146}
2147
2148void Demo::prepare() {
2149 prepare_init_cmd();
2150 prepare_textures();
2151 prepare_cube_data_buffers();
2152
2153 prepare_descriptor_layout();
2154 // Only need to know the format of the depth buffer before we create the renderpass
2155 depth.format = vk::Format::eD16Unorm;
2156 prepare_render_pass();
2157 prepare_pipeline();
2158
2159 for (auto &submission_resource : submission_resources) {
2160 auto alloc_return = device.allocateCommandBuffers(vk::CommandBufferAllocateInfo()
2161 .setCommandPool(cmd_pool)
2162 .setLevel(vk::CommandBufferLevel::ePrimary)
2163 .setCommandBufferCount(1));
2164 VERIFY(alloc_return.result == vk::Result::eSuccess);
2165 submission_resource.cmd = alloc_return.value[0];
2166 }
2167
2168 if (separate_present_queue) {
2169 auto present_cmd_pool_return =
2170 device.createCommandPool(vk::CommandPoolCreateInfo().setQueueFamilyIndex(present_queue_family_index));
2171 VERIFY(present_cmd_pool_return.result == vk::Result::eSuccess);
2172 present_cmd_pool = present_cmd_pool_return.value;
2173
2174 for (auto &submission_resource : submission_resources) {
2175 auto alloc_cmd_return = device.allocateCommandBuffers(vk::CommandBufferAllocateInfo()
2176 .setCommandPool(present_cmd_pool)
2177 .setLevel(vk::CommandBufferLevel::ePrimary)
2178 .setCommandBufferCount(1));
2179 VERIFY(alloc_cmd_return.result == vk::Result::eSuccess);
2180 submission_resource.graphics_to_present_cmd = alloc_cmd_return.value[0];
2181 }
2182 }
2183
2184 prepare_descriptor_pool();
2185 prepare_descriptor_set();
2186
2187 prepare_framebuffers();
2188
2189 prepare_submission_sync_objects();
2190
2191 /*
2192 * Prepare functions above may generate pipeline commands
2193 * that need to be flushed before beginning the render loop.
2194 */
2195 flush_init_cmd();
2196 if (staging_texture.buffer) {
2197 destroy_texture(staging_texture);
2198 }
2199
2200 initialized = true;
2201
2202 prepare_swapchain();
2203}
2204
2205// Creates the swapchain, swapchain image views, depth buffer, framebuffers, and sempahores.

Callers 2

WinMainFunction · 0.80
demo_mainFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected