Skip to content

fix c++ sort check_strict_weak_ording #18801

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

Open
wants to merge 1 commit into
base: v3.8.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
13 changes: 11 additions & 2 deletions native/cocos/renderer/pipeline/Define.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct CC_DLL RenderPass {
uint32_t shaderID = 0;
uint32_t passIndex = 0;
const scene::SubModel *subModel = nullptr;
uint32_t subModelID = 0;
};
using RenderPassList = ccstd::vector<RenderPass>;

Expand Down Expand Up @@ -185,7 +186,11 @@ inline bool opaqueCompareFn(const RenderPass &a, const RenderPass &b) {
return a.depth < b.depth;
}

return a.shaderID < b.shaderID;
if(a.shaderID != b.shaderID) {
return a.shaderID < b.shaderID;
}

return a.subModelID < b.subModelID;
}

inline bool transparentCompareFn(const RenderPass &a, const RenderPass &b) {
Expand All @@ -203,7 +208,11 @@ inline bool transparentCompareFn(const RenderPass &a, const RenderPass &b) {
return b.depth < a.depth;
}

return a.shaderID < b.shaderID;
if(a.shaderID != b.shaderID) {
return a.shaderID < b.shaderID;
}

return a.subModelID < b.subModelID;
}

inline uint32_t convertPhase(const ccstd::vector<ccstd::string> &stages) {
Expand Down
3 changes: 2 additions & 1 deletion native/cocos/renderer/pipeline/RenderQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ bool RenderQueue::insertRenderPass(const RenderObject &renderObj, uint32_t subMo
auto shaderId = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(subModel->getShader(passIdx)));
const auto hash = (0 << 30) | (passPriority << 16) | (modelPriority << 8) | passIdx;
const auto priority = renderObj.model->getPriority();
RenderPass renderPass = {priority, hash, renderObj.depth, shaderId, passIdx, subModel};
const auto subModelID = subModel->getId();
RenderPass renderPass = {priority, hash, renderObj.depth, shaderId, passIdx, subModel, subModelID};
_queue.emplace_back(renderPass);

return true;
Expand Down
Loading