Skip to content

Commit

Permalink
Merge branch 'v3.8.4' of https://github.com/cocos/cocos-engine into 3…
Browse files Browse the repository at this point in the history
…84-native-async-load
  • Loading branch information
dumganhar committed Jul 31, 2024
2 parents 0451617 + d6eeed0 commit c93d69f
Show file tree
Hide file tree
Showing 75 changed files with 3,009 additions and 7,895 deletions.
1 change: 1 addition & 0 deletions .github/workflows/gen_decorators.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const BUILD_CONFIG = {
'tiled-map', 'tween',
'ui', 'video',
'websocket', 'webview',
'legacy-pipeline',
],
loose: true,
mode: 'BUILD',
Expand Down
8 changes: 8 additions & 0 deletions EngineErrorMap.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@ Failed to set shading scale, pipelineSceneData is invalid.

Setting orientation is not supported yet.

### 1222

Failed to initialize render pipeline.

### 1223

Custom pipeline and legacy pipeline are all culled.

### 1300

%s is not in the model pool and cannot be destroyed by destroyModel.
Expand Down
28 changes: 17 additions & 11 deletions cc.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,20 @@
"custom-pipeline": {
"modules": ["custom-pipeline"],
"dependentAssets": [
"6a2d0734-bd9e-4ddf-946e-caa52498cb75"
]
},
"custom-pipeline-builtin-scripts": {
"modules": [],
"dependentScripts": [
"ff9b0199-ce04-4cfe-86cc-6c719f08d6e4",
"de1c2107-70c8-4021-8459-6399f24d01c6",
"cbf30902-517f-40dc-af90-a550bac27cf1"
]
},
"custom-pipeline-post-process": {
"modules": ["custom-pipeline-post-process"],
"dependentAssets":[
"15049ccd-4dd7-451e-a8ae-af66735c929e",
"521c5f6e-1a26-42e2-8108-4400c912d9bf",
"4c3ce6de-e6d1-47f7-aa36-36b9b58f72d3",
Expand All @@ -204,17 +218,9 @@
"45e7c0c8-2699-4912-b45f-d42bb8384189",
"84ac6f69-3086-455a-86a4-561da8ee710b",
"5c601d96-e4c7-4698-991b-7ee674b11079",
"bf0a6d94-58f0-4ad2-bdf2-c4a31c7dd856",
"6a2d0734-bd9e-4ddf-946e-caa52498cb75"
]
},
"custom-pipeline-builtin-scripts": {
"modules": [],
"dependentScripts": [
"ff9b0199-ce04-4cfe-86cc-6c719f08d6e4",
"de1c2107-70c8-4021-8459-6399f24d01c6",
"cbf30902-517f-40dc-af90-a550bac27cf1"
]
"bf0a6d94-58f0-4ad2-bdf2-c4a31c7dd856"
],
"dependentModules": ["custom-pipeline"]
},
"legacy-pipeline": {
"modules": ["legacy-pipeline"],
Expand Down
3 changes: 1 addition & 2 deletions cocos/core/platform/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ export function _resetDebugSetting (mode: DebugMode): void {
if (!condition) {
const errorText = formatString(message, ...optionalParams);
if (DEV) {
// eslint-disable-next-line no-debugger
debugger;
console.error(errorText);
} else {
throw new Error(errorText);
}
Expand Down
30 changes: 10 additions & 20 deletions cocos/game/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { EventTarget, AsyncDelegate, sys, macro, VERSION, cclegacy, screen, Sett
import { input } from '../input';
import { deviceManager, LegacyRenderMode } from '../gfx';
import { SplashScreen } from './splash-screen';
import { RenderPipeline } from '../rendering';
import { Layers, Node } from '../scene-graph';
import { builtinResMgr } from '../asset/asset-manager/builtin-res-mgr';
import { Director, director } from './director';
Expand Down Expand Up @@ -1126,27 +1125,18 @@ export class Game extends EventTarget {
}

private _setupRenderPipeline (): void | Promise<void> {
const renderPipeline = settings.querySettings(Settings.Category.RENDERING, 'renderPipeline') as string;
if (!renderPipeline || renderPipeline === 'ca127c79-69d6-4afd-8183-d712d7b80e14') {
// editor or 'builtin-pipeline', do not load asset
return this._setRenderPipeline();
}
return new Promise<RenderPipeline>((resolve, reject): void => {
assetManager.loadAny(renderPipeline, (err, asset): void => ((err || !(asset instanceof RenderPipeline))
? reject(err)
: resolve(asset)));
}).then((asset): void => {
this._setRenderPipeline(asset);
}).catch((reason): void => {
warn(reason);
warn(`Failed load render pipeline: ${renderPipeline}, engine failed to initialize, will fallback to default pipeline`);
this._setRenderPipeline();
});
const usesCustomPipeline = settings.querySettings(
Settings.Category.RENDERING,
'customPipeline',
);

return this._setRenderPipeline(!!usesCustomPipeline);
}

private _setRenderPipeline (rppl?: RenderPipeline): void {
if (!director.root!.setRenderPipeline(rppl)) {
this._setRenderPipeline();
private _setRenderPipeline (customPipeline: boolean): void {
if (!director.root!.setRenderPipeline(customPipeline)) {
errorID(1222);
return;
}

this._rendererInitialized = true;
Expand Down
19 changes: 14 additions & 5 deletions cocos/particle-2d/particle-simulator-2d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
THE SOFTWARE.
*/

import { Vec2, Color, js, misc, random, IColorLike } from '../core';
import { Vec2, Color, js, misc, random, IColorLike, Vec4 } from '../core';
import { vfmtPosUvColor, getComponentPerVertex } from '../2d/renderer/vertex-format';
import { PositionType, EmitterMode, START_SIZE_EQUAL_TO_END_SIZE, START_RADIUS_EQUAL_TO_END_RADIUS } from './define';
import { ParticleSystem2D } from './particle-system-2d';
Expand All @@ -33,6 +33,7 @@ const _pos = new Vec2();
const _tpa = new Vec2();
const _tpb = new Vec2();
const _tpc = new Vec2();
const _col = new Vec4();

const formatBytes = getComponentPerVertex(vfmtPosUvColor);

Expand Down Expand Up @@ -313,11 +314,19 @@ export class Simulator {
vbuf[offset + 28] = y + halfHeight;
vbuf[offset + 29] = 0;
}

// normalize
const pcol = particle.color as IColorLike;
_col.x = pcol.r / 255;
_col.y = pcol.g / 255;
_col.z = pcol.b / 255;
_col.w = pcol.a / 255;

// color
Color.toArray(vbuf, particle.color as IColorLike, offset + 5);
Color.toArray(vbuf, particle.color as IColorLike, offset + 14);
Color.toArray(vbuf, particle.color as IColorLike, offset + 23);
Color.toArray(vbuf, particle.color as IColorLike, offset + 32);
Vec4.toArray(vbuf, _col, offset + 5);
Vec4.toArray(vbuf, _col, offset + 14);
Vec4.toArray(vbuf, _col, offset + 23);
Vec4.toArray(vbuf, _col, offset + 32);
}

public step (dt: number): void {
Expand Down
12 changes: 6 additions & 6 deletions cocos/rendering/custom/archive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
*/
/* eslint-disable max-len */
export interface OutputArchive {
writeBool (value: boolean): void;
writeNumber (value: number): void;
writeString (value: string): void;
b (value: boolean): void;
n (value: number): void;
s (value: string): void;
}

export interface InputArchive {
readBool (): boolean;
readNumber (): number;
readString (): string;
b (): boolean;
n (): number;
s (): string;
}
16 changes: 8 additions & 8 deletions cocos/rendering/custom/binary-archive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@ export class BinaryOutputArchive implements OutputArchive {
this.buffer = new Uint8Array(this.capacity);
this.dataView = new DataView(this.buffer.buffer);
}
writeBool (value: boolean): void {
b (value: boolean): void {
const newSize = this.size + 1;
if (newSize > this.capacity) {
this.reserve(newSize);
}
this.dataView.setUint8(this.size, value ? 1 : 0);
this.size = newSize;
}
writeNumber (value: number): void {
n (value: number): void {
const newSize = this.size + 8;
if (newSize > this.capacity) {
this.reserve(newSize);
}
this.dataView.setFloat64(this.size, value, true);
this.size = newSize;
}
writeString (value: string): void {
this.writeNumber(value.length);
s (value: string): void {
this.n(value.length);
const newSize = this.size + value.length;
if (newSize > this.capacity) {
this.reserve(newSize);
Expand Down Expand Up @@ -78,16 +78,16 @@ export class BinaryInputArchive implements InputArchive {
constructor (data: ArrayBuffer) {
this.dataView = new DataView(data);
}
readBool (): boolean {
b (): boolean {
return this.dataView.getUint8(this.offset++) !== 0;
}
readNumber (): number {
n (): number {
const value = this.dataView.getFloat64(this.offset, true);
this.offset += 8;
return value;
}
readString (): string {
const length = this.readNumber();
s (): string {
const length = this.n();
// we only support ascii string now, so we can use String.fromCharCode
// see https://stackoverflow.com/questions/67057689/typscript-type-uint8array-is-missing-the-following-properties-from-type-numb
// answer on stackoverflow might be wrong.
Expand Down
147 changes: 0 additions & 147 deletions cocos/rendering/custom/builtin-pipelines.ts

This file was deleted.

Loading

0 comments on commit c93d69f

Please sign in to comment.