fixed 3d-tasks/18423: Rendering is not correct on VK backend. (#17526)

* fixed 3d-tasks/18423: Rendering is not correct on VK backend.
Async tasks must be executed after present.

* fix unused parameter lint error.
This commit is contained in:
James Chen
2024-08-13 09:22:00 +08:00
committed by GitHub
parent 0d8aedb3de
commit 2b032a2b8e
3 changed files with 8 additions and 2 deletions
@@ -130,10 +130,14 @@ static bool js_root_registerListeners(se::State &s) // NOLINT(readability-identi
DISPATCH_EVENT_TO_JS_ARGS_0(cc::Root::BeforeCommit, _onDirectorBeforeCommit, {});
DISPATCH_EVENT_TO_JS_ARGS_0(cc::Root::BeforeRender, _onDirectorBeforeRender, {});
DISPATCH_EVENT_TO_JS_ARGS_0(cc::Root::AfterRender, _onDirectorAfterRender, {
DISPATCH_EVENT_TO_JS_ARGS_0(cc::Root::AfterRender, _onDirectorAfterRender, {});
DISPATCH_EVENT_TO_JS_ARGS_0(cc::Root::PipelineChanged, _onDirectorPipelineChanged, {});
// NOTE: Async tasks must be executed after present, otherwise it will cause render issues on VK backend.
// Refer to https://github.com/cocos/3d-tasks/issues/18423
cobj->on<cc::Root::AfterPresent>([](cc::Root */*rootObj*/){
CC_CURRENT_APPLICATION()->getEngine()->getScheduler()->runFunctionsToBePerformedInCocosThread();
});
DISPATCH_EVENT_TO_JS_ARGS_0(cc::Root::PipelineChanged, _onDirectorPipelineChanged, {});
return true;
}
+1
View File
@@ -443,6 +443,7 @@ void Root::frameMoveEnd() {
emit<AfterRender>();
#endif
_device->present();
emit<AfterPresent>();
}
if (_batcher != nullptr) {
+1
View File
@@ -64,6 +64,7 @@ class Root final {
TARGET_EVENT_ARG0(BeforeCommit)
TARGET_EVENT_ARG0(BeforeRender)
TARGET_EVENT_ARG0(AfterRender)
TARGET_EVENT_ARG0(AfterPresent)
TARGET_EVENT_ARG0(PipelineChanged)
DECLARE_TARGET_EVENT_END()
public: