Skip to content

Commit

Permalink
Merge branch 'v3.8.6' of github.com:cocos/cocos-engine into v3.8.6-wgpu
Browse files Browse the repository at this point in the history
  • Loading branch information
GengineJS committed Dec 17, 2024
2 parents 94e291c + 0738856 commit 3c2ed35
Show file tree
Hide file tree
Showing 38 changed files with 410 additions and 271 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/build-wasm-libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ jobs:
fi
which ninja
- name: Apply emscripten patches
run: |
echo "--------------------------------- Save bind.cpp ---------------------------------"
cp $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp.bak
echo "--------------------------------- Apply embind bind.cpp patches ---------------------------------"
cp -f .github/workflows/emscripten-patches/embind/bind.cpp $EMSDK/upstream/emscripten/system/lib/embind/
echo "--------------------------------- Apply patches DONE! ---------------------------------"
cat $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp
- name: Build Spine WASM
run: |
cd ./native/cocos/editor-support/spine-wasm
Expand Down Expand Up @@ -72,3 +81,11 @@ jobs:
with:
name: spine-emscripten
path: dist

- name: Restore patches
run: |
echo "-------------------------- Restore patches ---------------------------------"
rm $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp
mv $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp.bak $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp
echo "-------------------------- Restore patches DONE! ---------------------------------"
cat $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp
110 changes: 83 additions & 27 deletions .github/workflows/web-interface-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@ jobs:
with:
node-version: '18.x'

- name: Setup emsdk
uses: dumganhar/setup-emsdk@997d2cde2deabda085a11f98e86e842915b0e846
with:
version: 3.1.41
actions-cache-folder: 'emsdk-cache-3.1.41'

- name: Verify
run: |
which emcc
emcc -v
- name: Install ninja
run: |
if ! command -v ninja &> /dev/null; then
echo "Ninja not found, installing..."
# sudo apt update
sudo apt install ninja-build
else
echo "Ninja is already installed."
fi
which ninja
- uses: actions/checkout@v4
name: Checkout Base Ref
with:
Expand All @@ -43,6 +65,51 @@ jobs:
ref: "${{ env.EXT_VERSION }}"
fetch-depth: 1

- name: Apply emscripten patches (BASE)
run: |
echo "--------------------------------- Save bind.cpp ---------------------------------"
cp $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp.bak
echo "--------------------------------- Apply embind bind.cpp patches ---------------------------------"
cp -f ./engine/.github/workflows/emscripten-patches/embind/bind.cpp $EMSDK/upstream/emscripten/system/lib/embind/
echo "--------------------------------- Apply patches DONE! ---------------------------------"
cat $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp
- name: Build Spine WASM (BASE)
run: |
cd ./engine/native/cocos/editor-support/spine-wasm
mkdir build-wasm
cd build-wasm
emcmake cmake .. -GNinja
ninja
ls -l
- name: Build Spine ASMJS (BASE)
run: |
cd ./engine/native/cocos/editor-support/spine-wasm
sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
mkdir build-asmjs
cd build-asmjs
emcmake cmake .. -GNinja
ninja
ls -l
- name: Copy files to external directory (BASE)
run: |
rm -rf dist
mkdir dist
cp ./engine/native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./dist/
cp ./engine/native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./dist/spine.wasm.js
cp ./engine/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./dist/
cp ./engine/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./dist/spine.asm.js
echo "-------- Before replace spine wasm -----------"
ls -l ./engine/native/external/emscripten/spine/
cp -f ./dist/* ./engine/native/external/emscripten/spine/
echo "-------- After replace spine wasm ------------"
ls -l ./engine/native/external/emscripten/spine/
echo "-----------------------------------------------"
cd ./engine/native/external
git status
- name: Build Base Declarations
working-directory: ./engine
run: |
Expand All @@ -51,6 +118,14 @@ jobs:
node ./.github/workflows/package-size-check.js
fi
- name: Restore patches (BASE)
run: |
echo "-------------------------- Restore patches ---------------------------------"
rm $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp
mv $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp.bak $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp
echo "-------------------------- Restore patches DONE! ---------------------------------"
cat $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp
- name: Clear npm Cache
run: |
npm cache clean --force
Expand Down Expand Up @@ -99,18 +174,7 @@ jobs:
ref: "${{ env.EXT_VERSION_HEAD }}"
fetch-depth: 1

- name: Setup emsdk
uses: dumganhar/setup-emsdk@997d2cde2deabda085a11f98e86e842915b0e846
with:
version: 3.1.41
actions-cache-folder: 'emsdk-cache-3.1.41'

- name: Verify
run: |
which emcc
emcc -v
- name: Apply emscripten patches
- name: Apply emscripten patches (HEAD)
run: |
echo "--------------------------------- Save bind.cpp ---------------------------------"
cp $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp.bak
Expand All @@ -119,18 +183,7 @@ jobs:
echo "--------------------------------- Apply patches DONE! ---------------------------------"
cat $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp
- name: Install ninja
run: |
if ! command -v ninja &> /dev/null; then
echo "Ninja not found, installing..."
# sudo apt update
sudo apt install ninja-build
else
echo "Ninja is already installed."
fi
which ninja
- name: Build Spine WASM
- name: Build Spine WASM (HEAD)
run: |
cd ./engine-HEAD/native/cocos/editor-support/spine-wasm
mkdir build-wasm
Expand All @@ -139,7 +192,7 @@ jobs:
ninja
ls -l
- name: Build Spine ASMJS
- name: Build Spine ASMJS (HEAD)
run: |
cd ./engine-HEAD/native/cocos/editor-support/spine-wasm
sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
Expand All @@ -149,8 +202,9 @@ jobs:
ninja
ls -l
- name: Copy files to external directory
- name: Copy files to external directory (HEAD)
run: |
rm -rf dist
mkdir dist
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./dist/
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./dist/spine.wasm.js
Expand All @@ -162,6 +216,8 @@ jobs:
echo "-------- After replace spine wasm ------------"
ls -l ./engine-HEAD/native/external/emscripten/spine/
echo "-----------------------------------------------"
cd ./engine-HEAD/native/external
git status
- name: Upload Artifact
uses: actions/upload-artifact@v4
Expand All @@ -175,7 +231,7 @@ jobs:
npm install
node ./.github/workflows/package-size-check.js
- name: Restore patches
- name: Restore patches (HEAD)
run: |
echo "-------------------------- Restore patches ---------------------------------"
rm $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp
Expand Down
8 changes: 4 additions & 4 deletions cocos/2d/event/pointer-event-dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ class PointerEventDispatcher implements IEventDispatcher {

constructor () {
input._registerEventDispatcher(this);

NodeEventProcessor.callbacksInvoker.on(DispatcherEventType.ADD_POINTER_EVENT_PROCESSOR, this.addPointerEventProcessor, this);
NodeEventProcessor.callbacksInvoker.on(DispatcherEventType.REMOVE_POINTER_EVENT_PROCESSOR, this.removePointerEventProcessor, this);
NodeEventProcessor.callbacksInvoker.on(DispatcherEventType.MARK_LIST_DIRTY, this._markListDirty, this);
const callbacksInvoker = NodeEventProcessor.callbacksInvoker;
callbacksInvoker.on(DispatcherEventType.ADD_POINTER_EVENT_PROCESSOR, this.addPointerEventProcessor, this);
callbacksInvoker.on(DispatcherEventType.REMOVE_POINTER_EVENT_PROCESSOR, this.removePointerEventProcessor, this);
callbacksInvoker.on(DispatcherEventType.MARK_LIST_DIRTY, this._markListDirty, this);
}

onThrowException (): void {
Expand Down
26 changes: 13 additions & 13 deletions cocos/root.jsb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
THE SOFTWARE.
*/

import { legacyCC } from './core/global-exports';
import { cclegacy } from './core/global-exports';
import { DataPoolManager } from './3d/skeletal-animation/data-pool-manager';
import { Device, deviceManager } from './gfx';
import { settings, Settings, warnID, Pool, macro, log, cclegacy } from './core';
import { settings, Settings, warnID, Pool, macro, log } from './core';
import { PipelineEventProcessor } from './rendering/pipeline-event';
import type { Root as JsbRoot } from './root';

Expand Down Expand Up @@ -55,8 +55,8 @@ export interface IRootInfo {
const rootProto: any = Root.prototype;

rootProto._createBatcher2D = function () {
if (!this._batcher && legacyCC.internal.Batcher2D) {
this._batcher = new legacyCC.internal.Batcher2D(this);
if (!this._batcher && cclegacy.internal.Batcher2D) {
this._batcher = new cclegacy.internal.Batcher2D(this);
if (!this._batcher!.initialize()) {
this._batcher = null;
this.destroy();
Expand Down Expand Up @@ -92,7 +92,7 @@ Object.defineProperty(rootProto, 'pipelineEvent', {

rootProto._ctor = function (device: Device) {
this._device = device;
this._dataPoolMgr = legacyCC.internal.DataPoolManager && new legacyCC.internal.DataPoolManager(device) as DataPoolManager;
this._dataPoolMgr = cclegacy.internal.DataPoolManager && new cclegacy.internal.DataPoolManager(device) as DataPoolManager;
this._modelPools = new Map();
this._lightPools = new Map();
this._batcher = null;
Expand Down Expand Up @@ -201,19 +201,19 @@ rootProto.recycleLight = function (l) {
};

rootProto._onDirectorBeforeCommit = function () {
legacyCC.director.emit(legacyCC.Director.EVENT_BEFORE_COMMIT);
cclegacy.director.emit(cclegacy.Director.EVENT_BEFORE_COMMIT);
};

rootProto._onDirectorBeforeRender = function () {
legacyCC.director.emit(legacyCC.Director.EVENT_BEFORE_RENDER);
cclegacy.director.emit(cclegacy.Director.EVENT_BEFORE_RENDER);
};

rootProto._onDirectorAfterRender = function () {
legacyCC.director.emit(legacyCC.Director.EVENT_AFTER_RENDER);
cclegacy.director.emit(cclegacy.Director.EVENT_AFTER_RENDER);
};

rootProto._onDirectorPipelineChanged = function () {
const scene = legacyCC.director.getScene();
const scene = cclegacy.director.getScene();
if (scene) {
scene._activate();
}
Expand All @@ -222,25 +222,25 @@ rootProto._onDirectorPipelineChanged = function () {
const oldOnGlobalPipelineStateChanged = rootProto.onGlobalPipelineStateChanged;
rootProto.onGlobalPipelineStateChanged = function() {
oldOnGlobalPipelineStateChanged.call(this);
const builder = legacyCC.rendering.getCustomPipeline(macro.CUSTOM_PIPELINE_NAME);
const builder = cclegacy.rendering.getCustomPipeline(macro.CUSTOM_PIPELINE_NAME);
if (builder) {
if (typeof builder.onGlobalPipelineStateChanged === 'function') {
builder.onGlobalPipelineStateChanged();
}
legacyCC.rendering.forceResizeAllWindows();
cclegacy.rendering.forceResizeAllWindows();
}
}

const oldFrameMove = rootProto.frameMove;
rootProto.frameMove = function (deltaTime: number) {
oldFrameMove.call(this, deltaTime, legacyCC.director.getTotalFrames());
oldFrameMove.call(this, deltaTime, cclegacy.director.getTotalFrames());
};

const oldSetPipeline = rootProto.setRenderPipeline;
rootProto.setRenderPipeline = function (customPipeline: boolean) {
let ppl;
if (customPipeline) {
legacyCC.rendering.createCustomPipeline();
cclegacy.rendering.createCustomPipeline();
ppl = oldSetPipeline.call(this, null);
log(`Using custom pipeline: ${macro.CUSTOM_PIPELINE_NAME}`);
} else {
Expand Down
Loading

0 comments on commit 3c2ed35

Please sign in to comment.