Skip to content

Fix duplicate rendering issue caused by failure to restore ibCount during batch merging #18721

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

Merged
merged 2 commits into from
May 20, 2025

Conversation

qiuguohua
Copy link
Contributor

Re: #

Changelog

#18704


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

Copy link

github-actions bot commented May 19, 2025

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1005977 bytes 1005977 bytes ✅ 0 bytes
2D All (legacy pipeline) 2671042 bytes 2671042 bytes ✅ 0 bytes
2D All (new pipeline) 2759549 bytes 2759549 bytes ✅ 0 bytes
(2D + 3D) All 10015498 bytes 10015498 bytes ✅ 0 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16837119 bytes 16837119 bytes ✅ 0 bytes

Interface Check Report

This pull request does not change any public interfaces !

@qiuguohua qiuguohua requested a review from star-e May 19, 2025 06:53
@@ -429,10 +428,10 @@ CC_FORCE_INLINE void Batcher2d::handleMiddlewareDraw(RenderEntity* entity, Rende
// check for merge draw
auto enableBatch = !entity->getUseLocal();
if (enableBatch && _currTexture == texture && _currMeshBuffer == meshBuffer && !_currEntity->getUseLocal() && material->getHash() == _currMaterial->getHash() && drawInfo->getIndexOffset() == _currDrawInfo->getIndexOffset() + _currDrawInfo->getIbCount() && layer == _currLayer) {
auto ibCount = _currDrawInfo->getIbCount();
_currDrawInfo->setIbCount(ibCount + drawInfo->getIbCount());
_currMiddlewareIbCount += drawInfo->getIbCount();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen if handleMiddlewareDraw is called multiple times with the same object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will cause duplicate rendering because the ibCount inside _currDrawInfo has been changed, but there is no place to revert the setting

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think duplicated rendering is acceptable. The program is correct, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause the shaded portion to be incorrect. #18704

@qiuguohua
Copy link
Contributor Author

@cocos-robot run test cases

Copy link

@qiuguohua, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
web-mobile PASS PASS FAIL
ios PASS PASS PASS
mac PASS PASS PASS

Copy link

@qiuguohua, Please check the result of run test cases:

Task Details

@star-e star-e merged commit ece10f8 into cocos:v3.8.7 May 20, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants