From 62adb234d1373b298dac95f834044e32dd4b884d Mon Sep 17 00:00:00 2001 From: Sungun Park Date: Mon, 6 Nov 2023 13:22:30 -0800 Subject: [PATCH] Cleanup RenderPassNode::declareRenderTarget (#7332) There's no functional change. Remove an unused local variable `outgoingEdges` to save CPU resource. Tidy up an usage of local variable to slightly improve readability. --- filament/src/fg/PassNode.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/filament/src/fg/PassNode.cpp b/filament/src/fg/PassNode.cpp index 071e3616fc6..12a3d6fd63e 100644 --- a/filament/src/fg/PassNode.cpp +++ b/filament/src/fg/PassNode.cpp @@ -82,22 +82,22 @@ uint32_t RenderPassNode::declareRenderTarget(FrameGraph& fg, FrameGraph::Builder RenderPassData data; data.name = name; data.descriptor = descriptor; - FrameGraphRenderPass::Attachments const& attachments = data.descriptor.attachments; // retrieve the ResourceNode of the attachments coming to us -- this will be used later // to compute the discard flags. DependencyGraph const& dependencyGraph = fg.getGraph(); auto incomingEdges = dependencyGraph.getIncomingEdges(this); - auto outgoingEdges = dependencyGraph.getOutgoingEdges(this); for (size_t i = 0; i < RenderPassData::ATTACHMENT_COUNT; i++) { - if (descriptor.attachments.array[i]) { - data.attachmentInfo[i] = attachments.array[i]; + FrameGraphId const& handle = + data.descriptor.attachments.array[i]; + if (handle) { + data.attachmentInfo[i] = handle; // TODO: this is not very efficient auto incomingPos = std::find_if(incomingEdges.begin(), incomingEdges.end(), - [&dependencyGraph, handle = descriptor.attachments.array[i]] + [&dependencyGraph, handle] (DependencyGraph::Edge const* edge) { ResourceNode const* node = static_cast( dependencyGraph.getNode(edge->from)); @@ -111,7 +111,7 @@ uint32_t RenderPassNode::declareRenderTarget(FrameGraph& fg, FrameGraph::Builder } // this could be either outgoing or incoming (if there are no outgoing) - data.outgoing[i] = fg.getActiveResourceNode(descriptor.attachments.array[i]); + data.outgoing[i] = fg.getActiveResourceNode(handle); if (data.outgoing[i] == data.incoming[i]) { data.outgoing[i] = nullptr; }