Skip to content

Commit

Permalink
Merge branch 'v3.8.5' into v3.8.5-pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
star-e committed Nov 8, 2024
2 parents 2c1c9c7 + dd7ff20 commit b7e0594
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 97 deletions.
7 changes: 7 additions & 0 deletions cocos/asset/asset-manager/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,13 @@ export class Downloader {
this.remoteBundles = remoteBundles;
}

/**
* @engineInternal
*/
public get handlers (): Record<string, DownloadHandler> {
return this._downloaders$;
}

/**
* @en
* Register custom handler if you want to change default behavior or extend downloader to download other format file.
Expand Down
4 changes: 2 additions & 2 deletions cocos/asset/assets/image-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

// @ts-check
import { ccclass, override } from 'cc.decorator';
import { EDITOR, ALIPAY, XIAOMI, JSB, TEST, BAIDU, TAOBAO, TAOBAO_MINIGAME, WECHAT_MINI_PROGRAM } from 'internal:constants';
import { EDITOR, ALIPAY, XIAOMI, JSB, TEST, BAIDU, TAOBAO, TAOBAO_MINIGAME, WECHAT_MINI_PROGRAM, BYTEDANCE } from 'internal:constants';
import { Device, Format, FormatFeatureBit, deviceManager } from '../../gfx';
import { Asset } from './asset';
import { PixelFormat } from './asset-enum';
Expand Down Expand Up @@ -163,7 +163,7 @@ function fetchImageSource (imageSource: ImageSource): HTMLCanvasElement | HTMLIm

// 返回该图像源是否是平台提供的图像对象。
function isNativeImage (imageSource: ImageSource): imageSource is (HTMLImageElement | HTMLCanvasElement | ImageBitmap) {
if (ALIPAY || TAOBAO || TAOBAO_MINIGAME || XIAOMI || BAIDU || WECHAT_MINI_PROGRAM) {
if (ALIPAY || TAOBAO || TAOBAO_MINIGAME || XIAOMI || BAIDU || WECHAT_MINI_PROGRAM || BYTEDANCE) {
// We're unable to grab the constructors of Alipay native image or canvas object.
return !('_data' in imageSource);
}
Expand Down
4 changes: 2 additions & 2 deletions cocos/core/memop/recycle-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ export class RecyclePool<T = any> extends ScalableContainer {
}

/**
* @en Expand the array size to 2 times the original size, and fills with new created elements.
* @zh 扩充对象池容量,会自动扩充尺寸到原来的 2 倍,并填充新的元素
* @en Adds a new element. If the capacity is insufficient, it will automatically expand to twice its original size.
* @zh 添加一个新元素,如果容量不足,会自动扩充尺寸到原来的 2 倍。
*/
public add (): T {
if (this._count$ >= this._data$.length) {
Expand Down
17 changes: 14 additions & 3 deletions cocos/rendering/custom/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ class BlitDesc {
constructor (blit: Blit) {
this._blit = blit;
}

/**
* @zh
* 创建四边形输入汇集器。
Expand Down Expand Up @@ -426,7 +425,7 @@ class BlitDesc {
this._lightBufferData.set(_vec4Array, idx * elementLen + fieldLen * 2);

if (isSpot) {
// cc_lightDir
// cc_lightDir
Vec3.toArray(_vec4Array, (light as SpotLight).direction);
this._lightBufferData.set(_vec4Array, idx * elementLen + fieldLen * 3);
}
Expand Down Expand Up @@ -496,6 +495,7 @@ class DeviceComputeQueue implements RecordingInterface {
private _renderPhase: RenderPhaseData | null = null;
private _descSetData: DescriptorSetData | null = null;
private _layoutID = -1;
private _isUpdateUBO = false;
private _isUploadInstance = false;
private _isUploadBatched = false;
private _queueId = -1;
Expand All @@ -521,12 +521,15 @@ class DeviceComputeQueue implements RecordingInterface {
get renderPhase (): RenderPhaseData | null { return this._renderPhase; }
set queueId (val) { this._queueId = val; }
get queueId (): number { return this._queueId; }
set isUpdateUBO (update: boolean) { this._isUpdateUBO = update; }
get isUpdateUBO (): boolean { return this._isUpdateUBO; }
set isUploadInstance (value: boolean) { this._isUploadInstance = value; }
get isUploadInstance (): boolean { return this._isUploadInstance; }
set isUploadBatched (value: boolean) { this._isUploadBatched = value; }
get isUploadBatched (): boolean { return this._isUploadBatched; }

reset (): void {
this._isUpdateUBO = false;
this._isUploadInstance = false;
this._isUploadBatched = false;
}
Expand All @@ -553,6 +556,7 @@ class DeviceRenderQueue implements RecordingInterface {
private _viewport: Viewport | null = null;
private _scissor: Rect | null = null;
private _layoutID = -1;
private _isUpdateUBO = false;
private _isUploadInstance = false;
private _isUploadBatched = false;
get phaseID (): number { return this._phaseID; }
Expand All @@ -574,6 +578,8 @@ class DeviceRenderQueue implements RecordingInterface {
private _queueId = -1;
set queueId (val) { this._queueId = val; }
get queueId (): number { return this._queueId; }
set isUpdateUBO (update: boolean) { this._isUpdateUBO = update; }
get isUpdateUBO (): boolean { return this._isUpdateUBO; }
set isUploadInstance (value: boolean) { this._isUploadInstance = value; }
get isUploadInstance (): boolean { return this._isUploadInstance; }
set isUploadBatched (value: boolean) { this._isUploadBatched = value; }
Expand Down Expand Up @@ -606,6 +612,7 @@ class DeviceRenderQueue implements RecordingInterface {
}
reset (): void {
this._renderScenes.length = 0;
this._isUpdateUBO = false;
this._isUploadInstance = false;
this._isUploadBatched = false;
this._blitDesc?.reset();
Expand Down Expand Up @@ -665,7 +672,7 @@ class RenderPassLayoutInfo {
const gfxBuf = deviceBuf?.buffer;

if (!gfxTex && !gfxBuf) {
throw new Error(`Could not find texture with resource name ${this._inputName}`);
throw Error(`Could not find texture with resource name ${this._inputName}`);
}

this._resID = context.resourceGraph.vertex(this._inputName);
Expand Down Expand Up @@ -1211,6 +1218,7 @@ class DeviceRenderScene implements RecordingInterface {
}

protected _updateRenderData (): void {
if (this._currentQueue.isUpdateUBO) return;
const devicePass = this._currentQueue.devicePass;
const rasterId = devicePass.rasterID;
const passRenderData = context.renderGraph.getData(rasterId);
Expand All @@ -1221,7 +1229,10 @@ class DeviceRenderScene implements RecordingInterface {
const queueId = this._currentQueue.queueId;
const queueRenderData = context.renderGraph.getData(queueId)!;
this._updateGlobal(queueRenderData, sceneId);
const sceneRenderData = context.renderGraph.getData(sceneId)!;
if (sceneRenderData) this._updateGlobal(sceneRenderData, sceneId);
context.passDescriptorSet?.update();
this._currentQueue.isUpdateUBO = true;
}

private _applyViewport (): void {
Expand Down
96 changes: 15 additions & 81 deletions cocos/ui/scroll-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,14 +500,7 @@ export class ScrollView extends ViewGroup {
* ```
*/
public scrollToBottom (timeInSecond?: number, attenuated = true): void {
assignMoveDeltaOption(0, 0, false, true);
const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions);

if (timeInSecond) {
this._startAutoScroll(moveDelta, timeInSecond, attenuated);
} else {
this._moveContent(moveDelta, true);
}
this._doScroll(0, 0, false, true, timeInSecond, attenuated);
}

/**
Expand All @@ -527,14 +520,7 @@ export class ScrollView extends ViewGroup {
* ```
*/
public scrollToTop (timeInSecond?: number, attenuated = true): void {
assignMoveDeltaOption(0, 1, false, true);
const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions);

if (timeInSecond) {
this._startAutoScroll(moveDelta, timeInSecond, attenuated);
} else {
this._moveContent(moveDelta);
}
this._doScroll(0, 1, false, true, timeInSecond, attenuated);
}

/**
Expand All @@ -554,14 +540,7 @@ export class ScrollView extends ViewGroup {
* ```
*/
public scrollToLeft (timeInSecond?: number, attenuated = true): void {
assignMoveDeltaOption(0, 0, true, false);
const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions);

if (timeInSecond) {
this._startAutoScroll(moveDelta, timeInSecond, attenuated);
} else {
this._moveContent(moveDelta);
}
this._doScroll(0, 0, true, false, timeInSecond, attenuated);
}

/**
Expand All @@ -581,14 +560,7 @@ export class ScrollView extends ViewGroup {
* ```
*/
public scrollToRight (timeInSecond?: number, attenuated = true): void {
assignMoveDeltaOption(1, 0, true, false);
const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions);

if (timeInSecond) {
this._startAutoScroll(moveDelta, timeInSecond, attenuated);
} else {
this._moveContent(moveDelta);
}
this._doScroll(1, 0, true, false, timeInSecond, attenuated);
}

/**
Expand All @@ -608,14 +580,7 @@ export class ScrollView extends ViewGroup {
* ```
*/
public scrollToTopLeft (timeInSecond?: number, attenuated = true): void {
assignMoveDeltaOption(0, 1, true, true);
const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions);

if (timeInSecond) {
this._startAutoScroll(moveDelta, timeInSecond, attenuated);
} else {
this._moveContent(moveDelta);
}
this._doScroll(0, 1, true, true, timeInSecond, attenuated);
}

/**
Expand All @@ -635,14 +600,7 @@ export class ScrollView extends ViewGroup {
* ```
*/
public scrollToTopRight (timeInSecond?: number, attenuated = true): void {
assignMoveDeltaOption(1, 1, true, true);
const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions);

if (timeInSecond) {
this._startAutoScroll(moveDelta, timeInSecond, attenuated);
} else {
this._moveContent(moveDelta);
}
this._doScroll(1, 1, true, true, timeInSecond, attenuated);
}

/**
Expand All @@ -662,14 +620,7 @@ export class ScrollView extends ViewGroup {
* ```
*/
public scrollToBottomLeft (timeInSecond?: number, attenuated = true): void {
assignMoveDeltaOption(0, 0, true, true);
const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions);

if (timeInSecond) {
this._startAutoScroll(moveDelta, timeInSecond, attenuated);
} else {
this._moveContent(moveDelta);
}
this._doScroll(0, 0, true, true, timeInSecond, attenuated);
}

/**
Expand All @@ -689,14 +640,7 @@ export class ScrollView extends ViewGroup {
* ```
*/
public scrollToBottomRight (timeInSecond?: number, attenuated = true): void {
assignMoveDeltaOption(1, 0, true, true);
const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions);

if (timeInSecond) {
this._startAutoScroll(moveDelta, timeInSecond, attenuated);
} else {
this._moveContent(moveDelta);
}
this._doScroll(1, 0, true, true, timeInSecond, attenuated);
}

/**
Expand Down Expand Up @@ -796,14 +740,7 @@ export class ScrollView extends ViewGroup {
* ```
*/
public scrollToPercentHorizontal (percent: number, timeInSecond: number, attenuated: boolean): void {
assignMoveDeltaOption(percent, 0, true, false);
const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions);

if (timeInSecond) {
this._startAutoScroll(moveDelta, timeInSecond, attenuated);
} else {
this._moveContent(moveDelta);
}
this._doScroll(percent, 0, true, false, timeInSecond, attenuated);
}

/**
Expand All @@ -829,14 +766,7 @@ export class ScrollView extends ViewGroup {
* ```
*/
public scrollTo (anchor: Vec2, timeInSecond?: number, attenuated?: boolean): void {
assignMoveDeltaOption(anchor.x, anchor.y, true, true);
const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions);

if (timeInSecond) {
this._startAutoScroll(moveDelta, timeInSecond, attenuated);
} else {
this._moveContent(moveDelta);
}
this._doScroll(anchor.x, anchor.y, true, true, timeInSecond, attenuated);
}

/**
Expand All @@ -857,7 +787,11 @@ export class ScrollView extends ViewGroup {
* ```
*/
public scrollToPercentVertical (percent: number, timeInSecond?: number, attenuated?: boolean): void {
assignMoveDeltaOption(0, percent, false, true);
this._doScroll(0, percent, false, true, timeInSecond, attenuated);
}

private _doScroll (x: number, y: number, applyToHorizontal: boolean, applyToVertical: boolean, timeInSecond?: number, attenuated = true): void {
assignMoveDeltaOption(x, y, applyToHorizontal, applyToVertical);
const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions);

if (timeInSecond) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ require('../fs-utils');
require('../../../../common/engine/index');
require('./VideoPlayer');
require('./Label');
require('./ImageAsset');
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const downloader = cc.assetManager.downloader;
const originalDownloadTTF = downloader._downloaders['.ttf'];
const originalDownloadTTF = downloader.handlers['.ttf'];

function downloadTTF (url, options, onComplete) {
// can't use cached ttf on Xiaomi platform
Expand Down

0 comments on commit b7e0594

Please sign in to comment.