mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -443,6 +443,7 @@ void Root::frameMoveEnd() {
|
||||
emit<AfterRender>();
|
||||
#endif
|
||||
_device->present();
|
||||
emit<AfterPresent>();
|
||||
}
|
||||
|
||||
if (_batcher != nullptr) {
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user