Skip to content

Commit

Permalink
subpass local attachment sort logic
Browse files Browse the repository at this point in the history
  • Loading branch information
hana-alice committed Sep 22, 2023
1 parent 2a44a31 commit 3e96166
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions native/cocos/renderer/pipeline/custom/FrameGraphDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,12 +791,15 @@ struct AttachmentSortKey {
gfx::SampleCount samples;
AccessType accessType;
uint32_t attachmentWeight;
const ccstd::pmr::string name;
uint32_t slotID;
const ccstd::pmr::string &slotName;
const ccstd::pmr::string &name;
};

struct AttachmentComparator {
bool operator()(const AttachmentSortKey &lhs, const AttachmentSortKey &rhs) const {
return std::tie(rhs.samples, lhs.accessType, lhs.attachmentWeight, lhs.name) < std::tie(lhs.samples, rhs.accessType, rhs.attachmentWeight, rhs.name);
return std::tie(rhs.samples, lhs.accessType, lhs.attachmentWeight, lhs.slotID, lhs.slotName, lhs.name) <
std::tie(lhs.samples, rhs.accessType, rhs.attachmentWeight, rhs.slotID, rhs.slotName, rhs.name);
}
};

Expand Down Expand Up @@ -956,6 +959,8 @@ auto checkRasterViews(const Graphs &graphs,
colorMap.emplace(AttachmentSortKey{desc.sampleCount,
rasterView.accessType,
ATTACHMENT_TYPE_WEIGHT[static_cast<uint32_t>(rasterView.attachmentType)],
rasterView.slotID,
rasterView.slotName1.empty() ? rasterView.slotName : rasterView.slotName1,
resName},
ViewInfo{desc.format,
LayoutAccess{lastAccess, accessFlag},
Expand Down Expand Up @@ -1051,6 +1056,8 @@ bool checkResolveResource(const Graphs &graphs,
colorMap.emplace(AttachmentSortKey{desc.sampleCount,
AccessType::WRITE,
ATTACHMENT_TYPE_WEIGHT[static_cast<uint32_t>(attachmentType)],
INVALID_ID,
"",
resolveTargetName},
ViewInfo{desc.format,
LayoutAccess{lastAccess, accessFlag},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void addRasterViewImpl(
auto &pass = get(RasterPassTag{}, passID, renderGraph);
CC_EXPECTS(subpass.subpassID < num_vertices(pass.subpassGraph));
auto &subpassData = get(SubpassGraph::SubpassTag{}, pass.subpassGraph, subpass.subpassID);
const auto slotID = getSlotID(pass, name, attachmentType);
const auto slotID = subpass.rasterViews.size();
CC_EXPECTS(subpass.rasterViews.size() == subpassData.rasterViews.size());
auto nameIter = subpassData.rasterViews.find(name);

Expand Down

0 comments on commit 3e96166

Please sign in to comment.