Refactor/batcher2d web native unification - #200
Draft
Tianze-Chen wants to merge 5 commits into
Draft
Tianze-Chen wants to merge 5 commits into
Tianze-Chen wants to merge 5 commits into
Conversation
…rchitecture Split the monolithic batcher-2d.ts (~1289 lines) into a layered architecture: - Batcher2D (facade): platform-agnostic delegation layer via IBatcherCore - IBatcherCore: interface mirroring C++ Batcher2d.h public API - WebBatcherCore: holds full Web rendering logic (walk, commit, merge, scene dispatch) - NativeBatcherCore: one-liners delegating to C++ via JSB - BatchGenerator: pure batch production engine (decoupled from UI types) - BufferManager: vertex buffer accessor pooling - DescriptorCache: descriptor-set caching with LocalDescriptorSet pool - MaskHandler: mask stencil batch generation - createBatcherCore: factory with compile-time tree-shaking (JSB constant) Key improvements: - Eliminated scattered 'if (JSB)' branches; platform dispatch via constructor - Removed _generator null checks via unified _core.generator accessor - Unified commitComp/commitMiddleware state-setting into BatchGenerator.setBatchState - Removed @engineInternal _releaseDescriptorSetCache backdoor - Web-only methods grouped at class bottom with explicit section comments - Original JSDoc formatting preserved Co-Authored-By: Claude <noreply@anthropic.com>
…to WebBatcherCore Deleted fillBuffers from all 9 Assembler implementations. Added universal vertex/color/index filling to WebBatcherCore: - _fillBuffers: dirty check, world transform, color fill, index write - _transformVerts: local coordinate × world matrix for any vertex count - Unified color handling covers RenderEntityFillColorType.COLOR mode Key changes: - sprite assemblers (5): removed fillBuffers + dead helpers - label assemblers (3): removed fillBuffers + fillMeshVertices3D calls - bmfontUtils: set renderData.indices after dynamic resize - IAssembler.fillBuffers declaration removed - commitComp: removed assembler.fillBuffers call (universal no-op) - BatchGenerator.setBatchStateFromComp helper on facade - _handleUIRenderer: commitComp before vertex fill (correct batching order) - Comment clarifies render.fillBuffers actual role (batch state, not buffer write) Net: -320 lines across assemblers, +55 in WebBatcherCore. Co-Authored-By: Claude <noreply@anthropic.com>
…and un-gate fill code RenderDrawInfo: fix 7 dropped setters (setVB/setIB/setVData/setIData/setIBCount/ setModel/setVertexPositionInWorld) to store TS fields on Web; add getters for all data fields so WebBatcherCore can read them; add Web-only localData reference (replaces native render2dBuffer), meshBuffer field, and meshRenderData back-reference for Particle2D isMeshBuffer COMP. RenderEntity: un-gate _dynamicDrawInfoArr maintenance (add/set/remove/clear) so Web entities actually hold drawInfos; add useLocal/renderTransform/fillColorType/priority getters; getRenderDrawInfosSize/At accessors for uniform iteration. RenderData/BaseRenderData: un-gate initRenderDrawInfo, setRenderDrawInfoAttributes, fillDrawInfoAttributes, updateRenderData material/texture/dataHash push, resize re-sync, and property setters — Web now populates drawInfos identically to JSB (JSB-only native writes remain gated). MeshRenderData: un-gate particleInitRenderDrawInfo and setRenderDrawInfoAttributes; add meshRenderData back-reference on Web. After this commit drawInfos exist on Web but are not yet read by the batcher (migration bridge still routes to legacy path when drawInfo count is 0). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…omponent types WebBatcherCore now routes all four RenderDrawInfoType variants through dedicated handlers instead of falling back to _commitLegacy: - COMP: _handleComponentDraw (existing P1b) + new _handleMeshBufferComp branch for Particle2D (isMeshBuffer=true, independent IA via MeshRenderData.requestIA). - MODEL: _handleModelDraw (existing P2/P2b) for Graphics and UIMeshRenderer. - MIDDLEWARE: _handleMiddlewareDraw — merges contiguous index segments by texture/material/meshBuffer/layer, mirrors native handleMiddlewareDraw. - SUB_NODE: _handleSubNode — re-enters walk() on drawInfo.subNode for Tiled embedded user nodes. CROSSED entity handling in walk(): when entity is CROSSED with drawInfos, skip child traversal (SUB_NODE drawInfos handle the reentry). Component-side adaptations: - Tiled: un-gate packRenderData (Web uses shared StaticVBAccessor + MIDDLEWARE type), un-gate updateRenderData→prepareDrawData, set meshBuffer on drawInfos, add setDirty. - Spine: add _populateMiddlewareDrawInfos — moves appendIndices/setDirty to pre-walk, synthesizes MIDDLEWARE drawInfos from _drawList; sync entity.useLocal with enableBatch. - DragonBones: same structure as Spine; fix createRenderEntity useLocal default from false to !enableBatch. - Graphics/UIMeshRenderer: populate MODEL drawInfo in updateRenderer (existing P2/P2b). The migration bridge (_commitLegacy) is no longer triggered by any component type but is retained until P5 cleanup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ugs, optimize - Remove dead facade methods: commitStaticBatch, autoMergeBatches, forceMergeBatches, resetRenderStates, finishMergeBatches, flushMaterial, setupStaticBatch, endStaticBatch, walk, batches, currBufferAccessor, currStaticRoot, currIsStatic, generator - Remove corresponding IBatcher/IBatcherCore interface entries and NativeBatcherCore empty stubs - Clean up unused imports (CachedArray, DrawBatch2D, Material, etc.) - Remove deprecated currBufferBatch→currBufferAccessor mapping - Add explicit public/private modifiers to all methods in batching/ - Add detailed update() comments for WebBatcherCore and NativeBatcherCore - Fix postUpdateAssembler not called when USE_SORTING_2D=true but getSorting2DCount()===0 - Remove unnecessary _fillBuffers call on invalid renderData - Optimize _transformVerts: cache matrix elements, skip perspective divide for 2D affine transforms, eliminate redundant array access - Fix pre-existing compile errors: batch-generator import path, NativeRenderDrawInfo meshBuffer declaration Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tianze-Chen
marked this pull request as draft
July 13, 2026 09:40
Contributor
Author
|
@cocos-robot run test cases |
Code Size Check Report
Interface Check Report! WARNING this pull request has changed these public interfaces:
@@ -1450,21 +1450,16 @@
* @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
*/
updateRenderer(): void;
/**
- * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
- */
- fillBuffers(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
- /**
* @en Post render data submission procedure, it's executed after assembler updated for all children.
* It may assemble some extra render data to the geometry buffers, or it may only change some render states.
* Don't call it unless you know what you are doing.
* @zh 后置渲染数据组装程序,它会在所有子节点的渲染数据组装完成后被调用。
* 它可能会组装额外的渲染数据到顶点数据缓冲区,也可能只是重置一些渲染状态。
* 注意:不要手动调用该函数,除非你理解整个流程。
*/
postUpdateAssembler(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
- protected _render(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
protected _postRender(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
protected _canRender(): boolean;
protected _postCanRender(): void;
protected _updateColor(): void;
@@ -1994,9 +1989,8 @@
* @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
*/
changeMaterialForDefine(): void;
protected _updateBuiltinMaterial(): Material;
- protected _render(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
protected _canRender(): boolean;
protected _flushAssembler(): void;
}
/**
@@ -2026,24 +2020,10 @@
onDisable(): void;
onLoad(): void;
onDestroy(): void;
/**
- * @en Render data submission procedure, it update and assemble the render data to 2D data buffers before all children submission process.
- * Usually called each frame when the ui flow assemble all render data to geometry buffers.
- * Don't call it unless you know what you are doing.
- * @zh 渲染数据组装程序,这个方法会在所有子节点数据组装之前更新并组装当前组件的渲染数据到 UI 的顶点数据缓冲区中。
- * 一般在 UI 渲染流程中调用,用于组装所有的渲染数据到顶点数据缓冲区。
- * 注意:不要手动调用该函数,除非你理解整个流程。
* @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
*/
- _render(render: __private._cocos_2d_renderer_i_batcher__IBatcher): boolean;
- /**
- * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
- */
- fillBuffers(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
- /**
- * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
- */
updateRenderer(): void;
/**
* @en Post render data submission procedure, it's executed after assembler updated for all children.
* It may assemble some extra render data to the geometry buffers, or it may only change some render states.
@@ -2663,9 +2643,8 @@
* @zh 更新渲染相关数据。
* @param force @en Whether to force an immediate update. @zh 是否立马强制更新渲染数据。
*/
updateRenderData(force?: boolean): void;
- protected _render(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
protected _updateColor(): void;
/**
* @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
*/
@@ -3375,9 +3354,8 @@
* @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
*/
activeSubModel(idx: number): void;
protected _uploadData(): void;
- protected _render(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
protected _flushAssembler(): void;
protected _canRender(): boolean;
/**
* @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
@@ -3540,9 +3518,8 @@
* @internal
*/
export interface IAssembler {
createData?(comp: UIRenderer): BaseRenderData;
- fillBuffers?(comp: UIRenderer, renderer: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
updateUVs?(comp: UIRenderer, ...args: any[]): void;
updateColor?(comp: UIRenderer): void;
updateRenderData?(comp: UIRenderer): void;
update?(comp: UIRenderer, dt: number): void;
@@ -3633,23 +3610,32 @@
*/
export const vfmtPosUvTwoColor4B: gfx.Attribute[];
}
/**
- * @en UI rendering process
- * @zh UI 渲染流程
+ * @en
+ * UI rendering process.
+ * Batcher2D acts as a FACADE: platform-agnostic methods delegate to the
+ * {@link IBatcherCore} implementation.
+ *
+ * @zh
+ * UI 渲染流程。
+ * Batcher2D 作为门面:平台无关的方法委托给 {@link IBatcherCore} 实现。
*/
export class UI implements __private._cocos_2d_renderer_i_batcher__IBatcher {
- protected _nativeObj: __private._cocos_2d_renderer_native_2d__NativeBatcher2d;
+ /** GFX device, injected from Root. */
+ device: gfx.Device;
+ /** @en Returns the underlying native Batcher2d JSB object. */
get nativeObj(): __private._cocos_2d_renderer_native_2d__NativeBatcher2d;
- get currBufferAccessor(): __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
- get batches(): memop.CachedArray<__private._cocos_2d_renderer_draw_batch__DrawBatch2D>;
- set currStaticRoot(value: UIStaticBatch | null);
/**
- * @deprecated since v3.8.7
+ * @en Injects the C++ Batcher2d JSB object.
+ * Called by Root._createBatcher2D() after construction.
+ *
+ * @zh 注入 C++ Batcher2d JSB 对象。由 Root._createBatcher2D() 在构造后调用。
*/
- set currIsStatic(value: boolean);
- device: gfx.Device;
+ set nativeObj(value: __private._cocos_2d_renderer_native_2d__NativeBatcher2d);
constructor(_root: Root);
+ /** @en Returns the underlying {@link IBatcherCore}. */
+ get core(): __private._cocos_2d_renderer_batching_batcher_core__IBatcherCore;
initialize(): boolean;
destroy(): void;
/**
* @en
@@ -3677,125 +3663,16 @@
reset(): void;
/**
* @zh 如果有必要,为相应的顶点布局切换网格缓冲区。
* @en Switch the mesh buffer for corresponding vertex layout if necessary.
- * @param attributes use VertexFormat.vfmtPosUvColor by default
*/
switchBufferAccessor(attributes?: gfx.Attribute[]): __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
registerBufferAccessor(key: number, accessor: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor): void;
- updateBuffer(attributes: gfx.Attribute[], bid: number): void;
/**
- * @en
- * Render component data submission process of UI.
- * The submitted vertex data is the UI for world coordinates.
- * For example: The UI components except Graphics and UIModel.
- *
- * @zh
- * UI 渲染组件数据提交流程(针对提交的顶点数据是世界坐标的提交流程,例如:除 Graphics 和 UIModel 的大部分 ui 组件)。
- * 此处的数据最终会生成需要提交渲染的 model 数据。
- *
- * @param comp - The committed renderable component
- * @param renderData - The render data being committed
- * @param frame - Texture or sprite frame related to the draw batch, could be null
- * @param assembler - The assembler for the current component, could be null
- * @param transform - Node type transform, if passed, then batcher will consider it's using model matrix, could be null
+ * @en Release the descriptor set cache associated with a texture.
+ * @zh 释放与纹理关联的 descriptor set 缓存。
*/
- commitComp(comp: UIRenderer, renderData: BaseRenderData | null, frame: __private._cocos_asset_assets_texture_base__TextureBase | SpriteFrame | null, assembler: IAssembler, transform: Node | null): void;
- /**
- * @en
- * Render component data submission process for individual [[gfx.InputAssembler]]
- * @zh
- * 渲染组件中针对独立 [[gfx.InputAssembler]] 的提交流程
- * 例如:Spine 和 DragonBones 等包含动态数据和材质的组件在内部管理 IA 并提交批次
- * @param comp - The committed renderable component
- * @param ia - The committed [[gfx.InputAssembler]]
- * @param tex - The texture used
- * @param mat - The material used
- * @param [transform] - The related node transform if the render data is based on node's local coordinates
- * @deprecated since v3.6.2, please use [[commitMiddleware]] instead
- */
- commitIA(renderComp: UIRenderer, ia: gfx.InputAssembler, tex?: __private._cocos_asset_assets_texture_base__TextureBase, mat?: Material, transform?: Node): void;
- /**
- * @en
- * Render component data submission process for middleware2d components
- * @zh
- * 渲染组件中针对2D中间件组件渲染数据的提交流程
- * 例如:Spine 和 DragonBones 包含动态数据和材质的组件
- * @param comp - The committed renderable component
- * @param meshBuffer - The MeshBuffer used
- * @param indexOffset - indices offset
- * @param indexCount - indices count
- * @param tex - The texture used
- * @param mat - The material used
- * @param enableBatch - component support multi draw batch or not
- */
- commitMiddleware(comp: UIRenderer, meshBuffer: MeshBuffer, indexOffset: number, indexCount: number, tex: __private._cocos_asset_assets_texture_base__TextureBase, mat: Material, enableBatch: boolean): void;
- /**
- * @en
- * Render component data submission process of UI.
- * The submitted vertex data is the UI for local coordinates.
- * For example: The UI components of Graphics and UIModel.
- *
- * @zh
- * UI 渲染组件数据提交流程(针对例如: Graphics 和 UIModel 等数据量较为庞大的 ui 组件)。
- *
- * @param comp - The committed renderable component
- * @param model - The committed model
- * @param mat - The material used, could be null
- */
- commitModel(comp: UIMeshRenderer | UIRenderer, model: renderer.scene.Model | null, mat: Material | null): void;
- setupStaticBatch(staticComp: UIStaticBatch, bufferAccessor: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor): void;
- endStaticBatch(): void;
- /**
- * @en
- * Submit separate render data.
- * This data does not participate in the batch.
- *
- * @zh
- * 提交独立渲染数据.
- * @param comp @en The UIStaticBatch component.
- * @zh 静态组件
- */
- commitStaticBatch(comp: UIStaticBatch): void;
- /**
- * @en
- * End a section of render data and submit according to the batch condition.
- *
- * @zh
- * 根据合批条件,结束一段渲染数据并提交。
- */
- autoMergeBatches(renderComp?: UIRenderer): void;
- /**
- * @en
- * Force changes to current batch data and merge
- *
- * @zh
- * 强行修改当前批次数据并合并。
- *
- * @param material @en The material of the current batch.
- * @zh 当前批次的材质。
- * @param sprite @en Sprite frame of current batch.
- * @zh 当前批次的精灵帧。
- */
- forceMergeBatches(material: Material, frame: __private._cocos_asset_assets_texture_base__TextureBase | SpriteFrame | null, renderComp: UIRenderer): void;
- resetRenderStates(): void;
- /**
- * @en
- * Forced to merge the data of the previous batch to start a new batch.
- *
- * @zh
- * 强制合并上一个批次的数据,开启新一轮合批。
- */
- finishMergeBatches(): void;
- /**
- * @en
- * Force to change the current material.
- *
- * @zh
- * 强制刷新材质。
- */
- flushMaterial(mat: Material): void;
- walk(node: Node, level?: number): void;
+ releaseDescriptorSetCache(textureOrHash: number | gfx.Texture | null, sampler?: gfx.Sampler | null): void;
syncMeshBuffersToNative(accId: number, buffers: MeshBuffer[]): void;
}
/**
* @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
@@ -38316,9 +38193,8 @@
* @zh 自定义材质。
*/
get customMaterial(): Material | null;
set customMaterial(val: Material | null);
- protected _render(batcher: UI): void;
__preload(): void;
/**
* @en Initialize asset data and internal data within the component.
* @zh 初始化资产数据以及组件内部数据。
@@ -46423,9 +46299,8 @@
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
_finishedSimulation(): void;
protected _canRender(): boolean;
- protected _render(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
protected _updatePositionType(): void;
}
/**
* @en
@@ -46500,12 +46375,8 @@
* myMotionStreak.reset();
*/
reset(): void;
lateUpdate(dt: number): void;
- /**
- * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
- */
- _render(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
}
export const MotionStreakAssemblerManager: IAssemblerManager;
export const ParticleSystem2DAssembler: IAssemblerManager;
/**
@@ -53577,8 +53448,9 @@
protected _textures: Texture2D[];
protected _animationName: string;
protected _skinName: string;
protected _drawList: memop.RecyclePool<__private._cocos_spine_skeleton__SkeletonDrawData>;
+ protected _drawInfoList: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfo[];
protected _materialCache: {
[key: string]: renderer.MaterialInstance;
};
paused: boolean;
@@ -53847,9 +53719,8 @@
updateAnimation(dt: number): void;
protected _updateCache(dt: number): void;
protected _emitCacheCompleteEvent(): void;
protected _flushAssembler(): void;
- protected _render(batcher: UI): void;
protected _updateBuiltinMaterial(): Material;
protected _updateAnimEnum(): void;
protected _updateSkinEnum(): void;
protected _refreshInspector(): void;
@@ -55603,9 +55474,8 @@
* 网格渲染数据数组的索引
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
_tiledDataArrayIdx: number;
- protected _render(ui: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
protected createRenderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
prepareDrawData(): void;
}
/**
@@ -63557,31 +63427,9 @@
allocateChunk(vertexCount: number, indexCount: number): _cocos_2d_renderer_static_vb_accessor__StaticVBChunk | null;
recycleChunk(chunk: _cocos_2d_renderer_static_vb_accessor__StaticVBChunk): void;
static generateID(): number;
}
- /** @mangle */
- export class _cocos_2d_renderer_draw_batch__DrawBatch2D {
- get passes(): renderer.Pass[];
- get shaders(): gfx.Shader[];
- model: renderer.scene.Model | null;
- texture: gfx.Texture | null;
- sampler: gfx.Sampler | null;
- useLocalData: Node | null;
- isStatic: boolean;
- textureHash: number;
- samplerHash: number;
- visFlags: number;
- inputAssembler: gfx.InputAssembler | null;
- descriptorSet: gfx.DescriptorSet | null;
- destroy(ui: _cocos_2d_renderer_i_batcher__IBatcher): void;
- clear(): void;
- fillPasses(mat: Material | null, dss: gfx.DepthStencilState | null, dssHash: number, patches: Readonly<renderer.IMacroPatch[] | null>): void;
- }
export interface _cocos_2d_renderer_i_batcher__IBatcher {
- currBufferAccessor: _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
- readonly batches: memop.CachedArray<_cocos_2d_renderer_draw_batch__DrawBatch2D>;
- currStaticRoot: UIStaticBatch | null;
- currIsStatic: boolean;
device: gfx.Device;
initialize(): boolean;
destroy(): void;
addScreen(comp: RenderRoot2D): void;
@@ -63591,26 +63439,20 @@
update(): void;
uploadBuffers(): void;
reset(): void;
switchBufferAccessor(attributes?: gfx.Attribute[]): _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
- commitComp(comp: UIRenderer, renderData: BaseRenderData | null, textureOrFrame: _cocos_asset_assets_texture_base__TextureBase | SpriteFrame | null, assembler: any, transform: Node | null): void;
- commitModel(comp: UIMeshRenderer | UIRenderer, model: renderer.scene.Model | null, mat: Material | null): void;
- setupStaticBatch(staticComp: UIStaticBatch, bufferAccessor: _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor): void;
- endStaticBatch(): void;
- commitStaticBatch(comp: UIStaticBatch): void;
- autoMergeBatches(renderComp?: UIRenderer): void;
- forceMergeBatches(material: Material, textureOrFrame: _cocos_asset_assets_texture_base__TextureBase | SpriteFrame | null, renderComp: UIRenderer): void;
- finishMergeBatches(): void;
- flushMaterial(mat: Material): void;
- walk(node: Node, level?: number): void;
}
export enum _cocos_2d_renderer_render_entity__MaskMode {
NONE = 0,
MASK = 1,
MASK_INVERTED = 2,
MASK_NODE = 3,
MASK_NODE_INVERTED = 4
}
+ export enum _cocos_2d_renderer_render_entity__RenderEntityFillColorType {
+ COLOR = 0,
+ VERTEX = 1
+ }
export class _cocos_2d_renderer_native_2d__NativeRenderDrawInfo {
constructor();
get vbBuffer(): ArrayBufferLike;
set vbBuffer(vbBuffer: ArrayBufferLike);
@@ -63629,8 +63471,10 @@
get model(): renderer.scene.Model | null;
set model(model: renderer.scene.Model | null);
get subNode(): Node;
set subNode(node: Node);
+ get meshBuffer(): any;
+ set meshBuffer(meshBuffer: any);
changeMeshBuffer(): any;
setRender2dBufferToNative(data: __types_globals__TypedArray): any;
syncSharedBufferToNative(data: __types_globals__TypedArray): any;
getAttrSharedBufferForJS(): ArrayBufferLike;
@@ -63664,33 +63508,49 @@
protected _accId: number;
protected _bufferId: number;
protected _vertexOffset: number;
protected _indexOffset: number;
- protected _vb: Float32Array | null;
- protected _ib: Uint16Array | null;
- protected _vData: Float32Array | null;
- protected _iData: Uint16Array | null;
protected _vertDirty: boolean;
protected _vbCount: number;
protected _ibCount: number;
protected _dataHash: number;
protected _isMeshBuffer: boolean;
+ protected _isVertexPositionInWorld: boolean;
protected _material: Material | null;
protected _texture: gfx.Texture | null;
protected _sampler: gfx.Sampler | null;
protected _stride: number;
protected _useLocal: boolean;
protected _model: renderer.scene.Model | null;
protected _drawInfoType: _cocos_2d_renderer_render_draw_info__RenderDrawInfoType;
protected _subNode: Node | null;
+ protected _meshBuffer: MeshBuffer | null;
protected _nativeObj: _cocos_2d_renderer_native_2d__NativeRenderDrawInfo;
protected _uint8SharedBuffer: Uint8Array;
protected _uint16SharedBuffer: Uint16Array;
protected _uint32SharedBuffer: Uint32Array;
protected _render2dBuffer: Float32Array | null;
constructor(nativeDrawInfo?: _cocos_2d_renderer_native_2d__NativeRenderDrawInfo);
get nativeObj(): _cocos_2d_renderer_native_2d__NativeRenderDrawInfo;
get render2dBuffer(): Float32Array | null;
+ get accId(): number;
+ get bufferId(): number;
+ get vertexOffset(): number;
+ get indexOffset(): number;
+ get vertDirty(): boolean;
+ get vbCount(): number;
+ get ibCount(): number;
+ get dataHash(): number;
+ get isMeshBuffer(): boolean;
+ get isVertexPositionInWorld(): boolean;
+ get material(): Material | null;
+ get texture(): gfx.Texture | null;
+ get sampler(): gfx.Sampler | null;
+ get stride(): number;
+ get model(): renderer.scene.Model | null;
+ get drawInfoType(): _cocos_2d_renderer_render_draw_info__RenderDrawInfoType;
+ get subNode(): Node | null;
+ get meshBuffer(): MeshBuffer | null;
clear(): void;
setAccId(accId: number): void;
setBufferId(bufferId: number): void;
setAccAndBuffer(accId: number, bufferId: number): void;
@@ -63711,8 +63571,9 @@
setSampler(sampler: gfx.Sampler | null): void;
setModel(model: renderer.scene.Model): void;
setDrawInfoType(drawInfoType: _cocos_2d_renderer_render_draw_info__RenderDrawInfoType): void;
setSubNode(node: Node): void;
+ setMeshBuffer(meshBuffer: MeshBuffer | null): void;
setStride(stride: number): void;
initRender2dBuffer(): void;
fillRender2dBuffer(vertexDataArr: IRenderData[]): void;
}
@@ -63720,12 +63581,8 @@
STATIC = 0,
DYNAMIC = 1,
CROSSED = 2
}
- export enum _cocos_2d_renderer_render_entity__RenderEntityFillColorType {
- COLOR = 0,
- VERTEX = 1
- }
/** @mangle */
export class _cocos_2d_renderer_render_entity__RenderEntity {
protected _node: Node | null;
protected _renderTransform: Node | null;
@@ -63733,14 +63590,22 @@
protected _colorDirty: boolean;
protected _enabled: boolean;
protected _useLocal: boolean;
protected _maskMode: _cocos_2d_renderer_render_entity__MaskMode;
+ protected _fillColorType: _cocos_2d_renderer_render_entity__RenderEntityFillColorType;
+ protected _priority: number;
protected _uint32SharedBuffer: Uint32Array;
protected _uint8SharedBuffer: Uint8Array;
protected _boolSharedBuffer: Uint8Array;
get nativeObj(): _cocos_2d_renderer_native_2d__NativeRenderEntity;
get renderDrawInfoArr(): _cocos_2d_renderer_render_draw_info__RenderDrawInfo[];
+ getRenderDrawInfosSize(): number;
+ getRenderDrawInfoAt(index: number): _cocos_2d_renderer_render_draw_info__RenderDrawInfo;
+ get fillColorType(): _cocos_2d_renderer_render_entity__RenderEntityFillColorType;
+ get priority(): number;
get renderEntityType(): _cocos_2d_renderer_render_entity__RenderEntityType;
+ get useLocal(): boolean;
+ get renderTransform(): Node | null;
setPriority(val: number): void;
protected _color: math.Color;
get color(): math.Color;
set color(val: math.Color);
@@ -63875,8 +63740,26 @@
}
export enum _cocos_2d_components_sprite__SpriteEventType {
SPRITE_FRAME_CHANGED = "spriteframe-changed"
}
+ /** @mangle */
+ export class _cocos_2d_renderer_draw_batch__DrawBatch2D {
+ get passes(): renderer.Pass[];
+ get shaders(): gfx.Shader[];
+ model: renderer.scene.Model | null;
+ texture: gfx.Texture | null;
+ sampler: gfx.Sampler | null;
+ useLocalData: Node | null;
+ isStatic: boolean;
+ textureHash: number;
+ samplerHash: number;
+ visFlags: number;
+ inputAssembler: gfx.InputAssembler | null;
+ descriptorSet: gfx.DescriptorSet | null;
+ destroy(ui: _cocos_2d_renderer_i_batcher__IBatcher): void;
+ clear(): void;
+ fillPasses(mat: Material | null, dss: gfx.DepthStencilState | null, dssHash: number, patches: Readonly<renderer.IMacroPatch[] | null>): void;
+ }
export class _cocos_2d_assembler_label_font_utils__CanvasPool {
static getInstance(): _cocos_2d_assembler_label_font_utils__CanvasPool;
pool: _cocos_2d_assembler_label_font_utils__ISharedLabelData[];
get(): _cocos_2d_assembler_label_font_utils__ISharedLabelData;
@@ -64104,8 +63987,25 @@
reset(): any;
syncRootNodesToNative(nodes: Node[]): any;
releaseDescriptorSetCache(texture: gfx.Texture, sampler: gfx.Sampler): any;
}
+ /**
+ * @en Core batcher interface. Every rendering operation the facade needs is routed through
+ * this interface. WebBatcherCore and NativeBatcherCore provide the two implementations.
+ *
+ * @zh 核心合批器接口。门面需要的每个渲染操作都通过此接口路由。
+ * WebBatcherCore 和 NativeBatcherCore 提供两种实现。
+ */
+ export interface _cocos_2d_renderer_batching_batcher_core__IBatcherCore {
+ initialize(): boolean;
+ update(): void;
+ uploadBuffers(): void;
+ reset(): void;
+ destroy(): void;
+ syncRootNodes(rootNodes: Node[]): void;
+ syncMeshBuffersToNative(accId: number, buffers: MeshBuffer[]): void;
+ releaseDescriptorSetCache(textureOrHash: number | gfx.Texture | null, sampler: gfx.Sampler | null): void;
+ }
export class _cocos_2d_utils_dynamic_atlas_atlas__DynamicAtlasTexture extends Texture2D {
/**
* @en
* Initialize the render texture.
|
|
@Tianze-Chen, Please check the result of
Task Details
|
|
@Tianze-Chen, Please check the result of
Task Details
|
Contributor
Author
|
@cocos-robot run test cases |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re: #
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: