Skip to content

Commit

Permalink
Cleanup RenderPassNode::declareRenderTarget (#7332)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
z3moon authored Nov 6, 2023
1 parent 53d8d2a commit 62adb23
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions filament/src/fg/PassNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<FrameGraphTexture> 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<ResourceNode const*>(
dependencyGraph.getNode(edge->from));
Expand All @@ -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;
}
Expand Down

0 comments on commit 62adb23

Please sign in to comment.