Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subpass output sort logic #16314

Merged
merged 3 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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