From d5556d5a5228f3eb2909c83e18ec677304d9c0a2 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 18 Nov 2024 11:41:37 +0800 Subject: [PATCH 1/3] Update ccbuild to 2.2.19 (#17870) --- package-lock.json | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index aaf50d4b99c..4f80c0c3249 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@babel/plugin-proposal-class-properties": "^7.18.6", "@cocos/box2d": "1.0.1", "@cocos/cannon": "1.2.8", - "@cocos/ccbuild": "^2.2.18", + "@cocos/ccbuild": "^2.2.19", "@cocos/dragonbones-js": "^1.0.1" }, "devDependencies": { @@ -2059,9 +2059,9 @@ } }, "node_modules/@cocos/ccbuild": { - "version": "2.2.18", - "resolved": "https://registry.npmjs.org/@cocos/ccbuild/-/ccbuild-2.2.18.tgz", - "integrity": "sha512-QG+T5bZiqH4KJ3wn0viSrSyVQmKpXOvA9c4z/D1w89Jy/P+YOQ1+ZCP7VSGXNHoQS8UsIO8ttcWP+WJuassUUw==", + "version": "2.2.19", + "resolved": "https://registry.npmjs.org/@cocos/ccbuild/-/ccbuild-2.2.19.tgz", + "integrity": "sha512-hVSyFRHAu/xegp1ZleAiEfDKbjhjv7Kldd1FBfhzUG2O30pkhZmiiNmfUiB+ppJ/9wQr2hcmwH/EuCMei0XvUA==", "dependencies": { "@babel/core": "^7.20.12", "@babel/helper-module-imports": "7.18.6", @@ -2075,7 +2075,7 @@ "@cocos/babel-plugin-dynamic-import-vars": "^1.0.2", "@cocos/creator-programming-babel-preset-cc": "1.0.1-alpha.5", "@cocos/rollup-plugin-node-resolve": "^15.3.0", - "@cocos/rollup-plugin-terser": "^0.4.4", + "@cocos/rollup-plugin-terser": "^0.4.5", "@cocos/tfig": "3.3.3", "@rollup/plugin-babel": "^6.0.3", "@rollup/plugin-commonjs": "^26.0.1", @@ -2599,9 +2599,9 @@ "integrity": "sha512-1bWAW8td2WTGicyCqxtpIjc1YuK5EzMWfMEWaJlskPAQwLS0JfxEGka71sZ1BzudiWiKS7hPMg+FvXr5NRnVwQ==" }, "node_modules/@cocos/rollup-plugin-terser": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/@cocos/rollup-plugin-terser/-/rollup-plugin-terser-0.4.4.tgz", - "integrity": "sha512-r+0IlDny3nXDXZq/IMzkjE7TVV04JI7vttD1VO1kggXpYRkY5VyAGKYJV7GBt8ntHtq21LDlF5EyZEMtw8YmZg==", + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/@cocos/rollup-plugin-terser/-/rollup-plugin-terser-0.4.5.tgz", + "integrity": "sha512-re21dIJ6P9lsJWvcc8oGNGqhwFRUzz/tbb/EoyOqlLv08cxjbaxEMuV30sCTw7hg0gXoZsNrwUx49tfWAj3WpQ==", "dependencies": { "jest-worker": "^29.7.0", "serialize-javascript": "^6.0.1", diff --git a/package.json b/package.json index f6635784817..de6268b2560 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "@babel/plugin-proposal-class-properties": "^7.18.6", "@cocos/box2d": "1.0.1", "@cocos/cannon": "1.2.8", - "@cocos/ccbuild": "^2.2.18", + "@cocos/ccbuild": "^2.2.19", "@cocos/dragonbones-js": "^1.0.1" } } From bd2dc0a5bf3134e5f77f44f323df65e51fbbd5e1 Mon Sep 17 00:00:00 2001 From: hyde zhou Date: Mon, 18 Nov 2024 14:36:50 +0800 Subject: [PATCH 2/3] fix native viewport (#17871) --- .../pipeline/custom/NativeExecutor.cpp | 38 ++++++++++++++++++- .../custom/NativeExecutorRenderGraph.h | 1 + 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/native/cocos/renderer/pipeline/custom/NativeExecutor.cpp b/native/cocos/renderer/pipeline/custom/NativeExecutor.cpp index d99e91df292..d2ef40dafae 100644 --- a/native/cocos/renderer/pipeline/custom/NativeExecutor.cpp +++ b/native/cocos/renderer/pipeline/custom/NativeExecutor.cpp @@ -440,6 +440,11 @@ struct RenderGraphVisitor : boost::dfs_visitor<> { } // scissor gfx::Rect scissor{vp.left, vp.top, vp.width, vp.height}; + // Do not across framebuffer boundary, otherwise vulkan will be device lost. + scissor.x = std::max(scissor.x, 0); + scissor.y = std::max(scissor.y, 0); + scissor.width = std::min(scissor.width, pass.width - scissor.x); + scissor.height = std::min(scissor.height, pass.height - scissor.y); // render pass { @@ -455,6 +460,12 @@ struct RenderGraphVisitor : boost::dfs_visitor<> { ctx.currentPass = data.renderPass.get(); } + // Set viewport + { + ctx.cmdBuff->setViewport(vp); + ctx.viewportStack.emplace_back(vp); + } + // PerPass DescriptorSet tryBindPassDescriptorSet(vertID); } @@ -477,7 +488,6 @@ struct RenderGraphVisitor : boost::dfs_visitor<> { if (subpass.subpassID) { ctx.cmdBuff->nextSubpass(); } - // ctx.cmdBuff->setViewport(subpass); tryBindPassDescriptorSet(vertID); ctx.subpassIndex = subpass.subpassID; // noop @@ -663,8 +673,12 @@ struct RenderGraphVisitor : boost::dfs_visitor<> { return; } } + if (queue.viewport.width != 0 && queue.viewport.height != 0) { ctx.cmdBuff->setViewport(queue.viewport); + ctx.viewportStack.emplace_back(queue.viewport); + } else { + ctx.viewportStack.emplace_back(); } tryBindQueueDescriptorSets(vertID); @@ -807,6 +821,8 @@ struct RenderGraphVisitor : boost::dfs_visitor<> { void begin(const gfx::Viewport& pass, RenderGraph::vertex_descriptor vertID) const { } void end(const RasterPass& pass, RenderGraph::vertex_descriptor vertID) const { + CC_EXPECTS(ctx.viewportStack.size() == 1); + const auto& renderData = get(RenderGraph::DataTag{}, ctx.g, vertID); if (!renderData.custom.empty()) { const auto& passes = ctx.ppl->custom.renderPasses; @@ -822,6 +838,8 @@ struct RenderGraphVisitor : boost::dfs_visitor<> { } ctx.cmdBuff->endRenderPass(); ctx.currentPass = nullptr; + ctx.viewportStack.pop_back(); + CC_ENSURES(ctx.viewportStack.empty()); } void end(const RasterSubpass& subpass, RenderGraph::vertex_descriptor vertID) const { // NOLINT(readability-convert-member-functions-to-static) const auto& renderData = get(RenderGraph::DataTag{}, ctx.g, vertID); @@ -891,6 +909,20 @@ struct RenderGraphVisitor : boost::dfs_visitor<> { return; } } + + // Revert viewport + CC_EXPECTS(ctx.viewportStack.size() > 1); + if (ctx.viewportStack.back()) { + for (size_t i = ctx.viewportStack.size() - 1; i-- > 0;) { + const auto& vp = ctx.viewportStack[i]; + if (vp) { + ctx.cmdBuff->setViewport(*vp); + break; + } + } + } + ctx.viewportStack.pop_back(); + #if CC_DEBUG ctx.cmdBuff->endMarker(); #endif @@ -1346,6 +1378,9 @@ void NativePipeline::executeRenderGraph(const RenderGraph& rg) { gfx::DescriptorSet*> perInstanceDescriptorSets(scratch); + ccstd::pmr::vector> viewportStack(scratch); + viewportStack.reserve(4); + // submit commands RenderGraphVisitorContext ctx{ ppl.nativeContext, @@ -1360,6 +1395,7 @@ void NativePipeline::executeRenderGraph(const RenderGraph& rg) { profilerPerPassDescriptorSets, perInstanceDescriptorSets, programLibrary, + viewportStack, CustomRenderGraphContext{ custom.currentContext, &rg, diff --git a/native/cocos/renderer/pipeline/custom/NativeExecutorRenderGraph.h b/native/cocos/renderer/pipeline/custom/NativeExecutorRenderGraph.h index da083bfd540..f30d3145e1b 100644 --- a/native/cocos/renderer/pipeline/custom/NativeExecutorRenderGraph.h +++ b/native/cocos/renderer/pipeline/custom/NativeExecutorRenderGraph.h @@ -72,6 +72,7 @@ struct RenderGraphVisitorContext { RenderGraph::vertex_descriptor, gfx::DescriptorSet*>& perInstanceDescriptorSets; ProgramLibrary* programLib = nullptr; + ccstd::pmr::vector>& viewportStack; CustomRenderGraphContext customContext; boost::container::pmr::memory_resource* scratch = nullptr; gfx::RenderPass* currentPass = nullptr; From 9f61f4914dbdabb44898e5d329ab48e97f8ab791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E7=82=9C=E6=B5=B7?= <35713518+dogodo-cc@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:51:23 +0800 Subject: [PATCH 3/3] feat: add physics-2d-box2d-wasm options (#17874) --- editor/engine-features/render-config.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/editor/engine-features/render-config.json b/editor/engine-features/render-config.json index bb3bf9ca6ee..b03314b40c1 100644 --- a/editor/engine-features/render-config.json +++ b/editor/engine-features/render-config.json @@ -151,6 +151,19 @@ "default": true, "isNativeModule": true }, + "physics-2d-box2d-wasm": { + "label": "i18n:ENGINE.features.physics_2d_box2d_wasm.label", + "description": "i18n:ENGINE.features.physics_2d_box2d_wasm.description", + "flags": { + "LOAD_BOX2D_MANUALLY": { + "label": "i18n:ENGINE.features.flags.box2d.loadManual.label", + "description": "i18n:ENGINE.features.flags.box2d.loadManual.description", + "ui-type": "checkbox", + "default": false + } + } + + }, "physics-2d-builtin": { "label": "i18n:ENGINE.features.physics_2d_builtin.label", "description": "i18n:ENGINE.features.physics_2d_builtin.description"