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

Method postprocessing

samples/performance/msaa/msaa.cpp:583–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581}
582
583void MSAASample::postprocessing(vkb::core::CommandBufferC &command_buffer,
584 vkb::rendering::RenderTargetC &render_target,
585 VkImageLayout &swapchain_layout,
586 bool msaa_enabled)
587{
588 auto depth_attachment = (msaa_enabled && depth_writeback_resolve_supported && resolve_depth_on_writeback) ? i_depth_resolve : i_depth;
589 bool multisampled_depth = msaa_enabled && !(depth_writeback_resolve_supported && resolve_depth_on_writeback);
590 std::string depth_sampler_name = multisampled_depth ? "ms_depth_sampler" : "depth_sampler";
591
592 glm::vec4 near_far = {camera->get_far_plane(), camera->get_near_plane(), -1.0f, -1.0f};
593
594 // Select the currently active pipeline
595 auto &pipeline = multisampled_depth ? ms_depth_postprocessing_pipeline : postprocessing_pipeline;
596
597 auto &postprocessing_pass = pipeline->get_pass(0);
598 postprocessing_pass.set_uniform_data(near_far);
599
600 auto &postprocessing_subpass = postprocessing_pass.get_subpass(0);
601 // Unbind sampled images to prevent invalid image transitions on unused images
602 postprocessing_subpass.unbind_sampled_image("depth_sampler");
603 postprocessing_subpass.unbind_sampled_image("ms_depth_sampler");
604
605 postprocessing_subpass.get_fs_variant().clear();
606
607 postprocessing_subpass
608 .bind_sampled_image(depth_sampler_name, {depth_attachment, nullptr, nullptr, depth_writeback_resolve_supported && resolve_depth_on_writeback})
609 .bind_sampled_image("color_sampler", i_color_resolve);
610
611 // Second render pass
612 // NOTE: Color and depth attachments are automatically transitioned to be bound as textures
613 pipeline->draw(command_buffer, render_target);
614
615 if (has_gui())
616 {
617 get_gui().draw(command_buffer);
618 }
619
620 command_buffer.end_render_pass();
621}
622
623void MSAASample::resolve_color_separate_pass(vkb::core::CommandBufferC &command_buffer,
624 const std::vector<vkb::core::ImageView> &views,

Callers

nothing calls this directly

Calls 6

unbind_sampled_imageMethod · 0.80
end_render_passMethod · 0.80
get_far_planeMethod · 0.45
get_near_planeMethod · 0.45
clearMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected