| 9 | namespace render_graph { |
| 10 | |
| 11 | void CullPhase::on_compile(RenderGraph* graph) SKR_NOEXCEPT |
| 12 | { |
| 13 | SkrZoneScopedN("RenderGraphCull"); |
| 14 | auto& resources = get_resources(graph); |
| 15 | auto& passes = get_passes(graph); |
| 16 | |
| 17 | resources.remove_all_if( |
| 18 | [this](ResourceNode* resource) { |
| 19 | SKR_UNUSED const auto name = resource->get_name_view(); |
| 20 | SkrZoneScopedC(tracy::Color::SteelBlue); |
| 21 | ZoneName((const char*)name.raw().data(), name.size()); |
| 22 | |
| 23 | const bool lone = !(resource->incoming_edges() + resource->outgoing_edges()); |
| 24 | { |
| 25 | SkrZoneScopedN("RecordDealloc"); |
| 26 | if (lone) culled_resources.add(resource); |
| 27 | } |
| 28 | return lone; |
| 29 | }); |
| 30 | |
| 31 | passes.remove_all_if( |
| 32 | [this](PassNode* pass) { |
| 33 | SKR_UNUSED const auto name = pass->get_name_view(); |
| 34 | SkrZoneScopedC(tracy::Color::SteelBlue); |
| 35 | ZoneName((const char*)name.raw().data(), name.size()); |
| 36 | |
| 37 | const bool lone = !(pass->incoming_edges() + pass->outgoing_edges()); |
| 38 | const bool can_be_lone = pass->get_can_be_lone(); |
| 39 | const bool culled = lone && !can_be_lone; |
| 40 | { |
| 41 | SkrZoneScopedN("RecordDealloc"); |
| 42 | if (culled) culled_passes.add(pass); |
| 43 | } |
| 44 | return culled; |
| 45 | }); |
| 46 | } |
| 47 | |
| 48 | void CullPhase::on_execute(RenderGraph* graph, RenderGraphProfiler* profiler) SKR_NOEXCEPT |
| 49 | { |
no test coverage detected