Skip to content

Update base.ts, 导出一些渲染相关的接口#18918

Open
finscn wants to merge 3 commits into
cocos:v3.8.8from
finscn:patch-32
Open

Update base.ts, 导出一些渲染相关的接口#18918
finscn wants to merge 3 commits into
cocos:v3.8.8from
finscn:patch-32

Conversation

@finscn

@finscn finscn commented Aug 19, 2025

Copy link
Copy Markdown
Contributor

这些接口不需要写入文档. 给那些愿意阅读 cocos 代码以及对 cocos 进行扩展的高级 cocos 开发者使用.
主要是用来在项目中实现自己的 UIRenderer子类 和 Assembler .

经过一段时间的尝试, 总结了一下 这个PR 里的类和接口是一定要导出的, 否则很难扩展.

Re: #

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

Greptile Summary

Adds exports for Stage enum and StencilManager class from the stencil-manager module to base.ts, completing a series of export additions for advanced Cocos developers.

  • Part of an incremental effort to expose rendering internals for custom UIRenderer subclasses and Assembler implementations
  • Previous commits already exported IBatcher, Batcher2D, StaticVBAccessor, StaticVBChunk, RenderDrawInfo, RenderDrawInfoType, RenderEntity, RenderEntityType, and RenderEntityFillColorType
  • The exported Stage enum is marked as @deprecated since v3.7.0 in the source file with a note that it's an "engine private interface that will be removed in the future"
  • The exported StencilManager class has the same deprecation warning
  • Exporting deprecated/internal interfaces increases maintenance burden and creates implicit API contracts

Confidence Score: 4/5

  • Safe to merge with minor concern about exporting deprecated interfaces
  • The change is syntactically correct and consistent with previous commits in this series. All exported items exist and are already exported from their source modules. However, exporting Stage and StencilManager which are explicitly marked as @deprecated since v3.7.0 with warnings about future removal creates a tension between supporting advanced use cases and maintaining a stable API surface. The PR description acknowledges these are for advanced developers willing to read engine code, but doesn't address the deprecation status.
  • No files require special attention

Important Files Changed

Filename Overview
cocos/2d/renderer/base.ts Adds exports for Stage and StencilManager from stencil-manager module to support custom UIRenderer and Assembler implementations

Sequence Diagram

sequenceDiagram
    participant Dev as Advanced Developer
    participant Base as base.ts (Module Entry)
    participant SM as stencil-manager.ts
    participant Index as 2d/index.ts
    participant App as User Application
    
    Note over Base: PR adds Stage & StencilManager exports
    
    Dev->>Base: Import rendering interfaces
    Base->>SM: Re-export Stage enum
    Base->>SM: Re-export StencilManager class
    
    Base->>Index: Exported via export * from './renderer/base'
    Index->>App: Available for custom UIRenderer implementations
    
    Note over App: Enables extending UIRenderer<br/>and creating custom Assemblers
    
    App->>SM: Use Stage for stencil states
    App->>SM: Use StencilManager for stencil operations
Loading

这些接口不需要写入文档.
供高级 cocos 开发者使用.
主要是用来在项目中实现自己的 UIRenderer子类 和 Assembler .

经过一段时间的尝试, 总结了一下 这个PR 里的类和接口是一定要导出的, 否则很难扩展.
@github-actions

github-actions Bot commented Aug 19, 2025

Copy link
Copy Markdown

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1009738 bytes 1010105 bytes ⚠️ +367 bytes
2D All (legacy pipeline) 2675347 bytes 2675755 bytes ⚠️ +408 bytes
2D All (new pipeline) 2767083 bytes 2767491 bytes ⚠️ +408 bytes
(2D + 3D) All 10024081 bytes 10024501 bytes ⚠️ +420 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16843143 bytes 16843563 bytes ⚠️ +420 bytes

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -496,10 +496,10 @@
          * @en Stencil stage.
          * @zh 模板缓冲阶段。
          * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
          */
-        get stage(): __private._cocos_2d_renderer_stencil_manager__Stage;
-        set stage(val: __private._cocos_2d_renderer_stencil_manager__Stage);
+        get stage(): Stage;
+        set stage(val: Stage);
         /**
          * @en Stencil pattern.
          * @zh 模板缓冲样式。
          * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
@@ -524,9 +524,9 @@
          * @en clear stencil stage.
          * @zh 清空模板状态。
          * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
          */
-        clear(comp: UIRenderer | UIMeshRenderer): __private._cocos_2d_renderer_stencil_manager__Stage;
+        clear(comp: UIRenderer | UIMeshRenderer): Stage;
         /**
          * @en Open stencil stage to enabled.
          * @zh 开启模板状态。
          * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
@@ -567,15 +567,15 @@
          * @en Get stencil stage.
          * @zh 获取模板状态。
          * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
          */
-        getStencilStage(stage: __private._cocos_2d_renderer_stencil_manager__Stage, mat?: Material): gfx.DepthStencilState;
+        getStencilStage(stage: Stage, mat?: Material): gfx.DepthStencilState;
         /**
          * @en Get stencil hash.
          * @zh 获取模板状态的哈希值。
          * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
          */
-        getStencilHash(stage: __private._cocos_2d_renderer_stencil_manager__Stage): number;
+        getStencilHash(stage: Stage): number;
     }
     export const spriteAssembler: IAssemblerManager;
     export const labelAssembler: IAssemblerManager;
     /**
@@ -1257,17 +1257,17 @@
          * 它可能会组装额外的渲染数据到顶点数据缓冲区,也可能只是重置一些渲染状态。
          * 注意:不要手动调用该函数,除非你理解整个流程。
          * @deprecated since v3.4.1, please use [[UIRenderer]] instead.
          */
-        postUpdateAssembler(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
+        postUpdateAssembler(render: IBatcher): void;
         /**
          * @deprecated since v3.4.1, please use [[UIRenderer]] instead.
          */
         markForUpdateRenderData(enable?: boolean): void;
         /**
          * @deprecated since v3.4.1, please use [[UIRenderer]] instead.
          */
-        stencilStage: __private._cocos_2d_renderer_stencil_manager__Stage;
+        stencilStage: Stage;
         /**
          * @deprecated since v3.4.1, please use [[UIRenderer]] instead.
          */
         setNodeDirty(): void;
@@ -1376,20 +1376,20 @@
          * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
          * @en The component stencil stage (please do not any modification directly on this object)
          * @zh 组件模板缓冲状态 (注意:请不要直接修改它的值)
          */
-        get stencilStage(): __private._cocos_2d_renderer_stencil_manager__Stage;
-        set stencilStage(val: __private._cocos_2d_renderer_stencil_manager__Stage);
+        get stencilStage(): Stage;
+        set stencilStage(val: Stage);
         protected _materials: (Material | null)[];
         protected _customMaterial: Material | null;
         protected _srcBlendFactor: gfx.BlendFactor;
         protected _dstBlendFactor: gfx.BlendFactor;
         protected _color: math.Color;
-        protected _stencilStage: __private._cocos_2d_renderer_stencil_manager__Stage;
+        protected _stencilStage: Stage;
         protected _assembler: IAssembler | null;
         protected _postAssembler: IAssembler | null;
         protected _renderFlag: boolean;
-        protected _renderEntity: __private._cocos_2d_renderer_render_entity__RenderEntity;
+        protected _renderEntity: RenderEntity;
         protected _instanceMaterialType: number;
         protected _srcBlendFactorCache: gfx.BlendFactor;
         protected _dstBlendFactorCache: gfx.BlendFactor;
         /**
@@ -1404,13 +1404,13 @@
         set priority(val: number);
         /**
          * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
          */
-        get batcher(): UI;
+        get batcher(): Batcher2D;
         /**
          * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
          */
-        get renderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
+        get renderEntity(): RenderEntity;
         /**
          * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
          */
         protected set _useVertexOpacity(val: boolean);
@@ -1439,9 +1439,9 @@
          * @en Request new render data object.
          * @zh 请求新的渲染数据对象。
          * @return @en The new render data. @zh 新的渲染数据。
          */
-        requestRenderData(drawInfoType?: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfoType): RenderData;
+        requestRenderData(drawInfoType?: RenderDrawInfoType): RenderData;
         /**
          * @en Destroy current render data.
          * @zh 销毁当前渲染数据。
          */
@@ -1452,20 +1452,20 @@
         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;
+        fillBuffers(render: 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;
+        postUpdateAssembler(render: IBatcher): void;
+        protected _render(render: IBatcher): void;
+        protected _postRender(render: IBatcher): void;
         protected _canRender(): boolean;
         protected _postCanRender(): void;
         protected _updateColor(): void;
         /**
@@ -1496,9 +1496,9 @@
         /**
          * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
          */
         setTextureDirty(): void;
-        protected createRenderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
+        protected createRenderEntity(): RenderEntity;
     }
     /**
      * @en
      * The component of transform in UI.
@@ -1994,9 +1994,9 @@
          * @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 _render(render: IBatcher): void;
         protected _canRender(): boolean;
         protected _flushAssembler(): void;
     }
     /**
@@ -2017,9 +2017,9 @@
          * @en Get the model component on this node
          * @zh 获取同节点的 model 组件
          */
         get modelComponent(): ModelRenderer | null;
-        protected _renderEntity: __private._cocos_2d_renderer_render_entity__RenderEntity;
+        protected _renderEntity: RenderEntity;
         _dirtyVersion: number;
         _internalId: number;
         __preload(): void;
         onEnable(): void;
@@ -2034,13 +2034,13 @@
          * 一般在 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;
+        _render(render: 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;
+        fillBuffers(render: IBatcher): void;
         /**
          * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
          */
         updateRenderer(): void;
@@ -2051,18 +2051,18 @@
          * @zh 后置渲染数据组装程序,它会在所有子节点的渲染数据组装完成后被调用。
          * 它可能会组装额外的渲染数据到顶点数据缓冲区,也可能只是重置一些渲染状态。
          * 注意:不要手动调用该函数,除非你理解整个流程。
          */
-        postUpdateAssembler(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
+        postUpdateAssembler(render: IBatcher): void;
         update(): void;
         /**
          * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
          */
         markForUpdateRenderData(enable?: boolean): void;
         /**
          * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
          */
-        stencilStage: __private._cocos_2d_renderer_stencil_manager__Stage;
+        stencilStage: Stage;
         /**
          * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
          */
         setNodeDirty(): void;
@@ -2073,9 +2073,9 @@
         protected _canRender(): boolean;
         /**
          * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
          */
-        get renderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
+        get renderEntity(): RenderEntity;
         protected _renderData: RenderData | null;
         /**
          * @deprecated Since v3.7.0, this is an engine private interface that will be removed in the future.
          */
@@ -2146,11 +2146,11 @@
         get color(): Readonly<math.Color>;
         set color(value: Readonly<math.Color>);
         get drawBatchList(): __private._cocos_2d_renderer_draw_batch__DrawBatch2D[];
         protected _init: boolean;
-        protected _bufferAccessor: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor | null;
+        protected _bufferAccessor: StaticVBAccessor | null;
         protected _dirty: boolean;
-        postUpdateAssembler(render: __private._cocos_2d_renderer_i_batcher__IBatcher): void;
+        postUpdateAssembler(render: IBatcher): void;
         /**
          * @en
          * Recollect data tags.
          * The render data will be recollected during the render phase of the current frame, and the next frame will be rendered using fixed data.
@@ -2165,9 +2165,9 @@
          * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
          */
         _requireDrawBatch(): __private._cocos_2d_renderer_draw_batch__DrawBatch2D;
         protected _clearData(): void;
-        protected _getBatcher(): UI | null;
+        protected _getBatcher(): Batcher2D | null;
     }
     /**
      * @en Shadow effect for Label component, only for system fonts or TTF fonts.
      * @zh 用于给 Label 组件添加阴影效果,只能用于系统字体或 ttf 字体。
@@ -2663,9 +2663,9 @@
          * @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 _render(render: IBatcher): void;
         protected _updateColor(): void;
         /**
          * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
          */
@@ -2752,9 +2752,9 @@
         protected _segments: number;
         protected _alphaThreshold: number;
         protected _sprite: Sprite | null;
         protected _graphics: GraphicsComponent | null;
-        protected _stencilStage: __private._cocos_2d_renderer_stencil_manager__Stage;
+        protected _stencilStage: Stage;
         onLoad(): void;
         onEnable(): void;
         onRestore(): void;
         onDisable(): void;
@@ -3365,16 +3365,16 @@
          * @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 _render(render: 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.
          */
         updateRenderer(): void;
-        protected createRenderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
+        protected createRenderEntity(): RenderEntity;
     }
     /**
      * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
      */
@@ -3394,13 +3394,13 @@
         get indexCount(): number;
         get stride(): number;
         get floatStride(): number;
         get vertexFormat(): gfx.Attribute[];
-        get drawInfoType(): __private._cocos_2d_renderer_render_draw_info__RenderDrawInfoType;
-        set drawInfoType(type: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfoType);
-        chunk: __private._cocos_2d_renderer_static_vb_accessor__StaticVBChunk;
-        protected _renderDrawInfo: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfo;
-        get renderDrawInfo(): __private._cocos_2d_renderer_render_draw_info__RenderDrawInfo;
+        get drawInfoType(): RenderDrawInfoType;
+        set drawInfoType(type: RenderDrawInfoType);
+        chunk: StaticVBChunk;
+        protected _renderDrawInfo: RenderDrawInfo;
+        get renderDrawInfo(): RenderDrawInfo;
         protected _material: Material | null;
         get material(): Material | null;
         set material(val: Material | null);
         protected _dataHash: number;
@@ -3410,17 +3410,17 @@
         protected _vc: number;
         protected _ic: number;
         protected _floatStride: number;
         protected _vertexFormat: gfx.Attribute[];
-        protected _drawInfoType: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfoType;
+        protected _drawInfoType: RenderDrawInfoType;
         protected _multiOwner: boolean;
         get multiOwner(): boolean;
         set multiOwner(val: boolean);
-        protected _batcher: UI | null;
-        get batcher(): UI;
+        protected _batcher: Batcher2D | null;
+        get batcher(): Batcher2D;
         constructor(vertexFormat?: gfx.Attribute[]);
-        isValid(): false | __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
-        initRenderDrawInfo(comp: UIRenderer, drawInfoType?: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfoType): void;
+        isValid(): false | StaticVBAccessor;
+        initRenderDrawInfo(comp: UIRenderer, drawInfoType?: RenderDrawInfoType): void;
         /**
          * @deprecated Please use RenderEntity.clearRenderDrawInfos instead.
          */
         removeRenderDrawInfo(comp: UIRenderer): void;
@@ -3428,9 +3428,9 @@
     /**
      * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
      */
     export class RenderData extends BaseRenderData {
-        static add(vertexFormat?: gfx.Attribute[], accessor?: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor | null): RenderData;
+        static add(vertexFormat?: gfx.Attribute[], accessor?: StaticVBAccessor | null): RenderData;
         static remove(data: RenderData): void;
         get dataLength(): number;
         set dataLength(length: number);
         get data(): IRenderData[];
@@ -3447,22 +3447,22 @@
         nodeDirty: boolean;
         passDirty: boolean;
         textureDirty: boolean;
         hashDirty: boolean;
-        protected _accessor: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
-        get accessor(): __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
+        protected _accessor: StaticVBAccessor;
+        get accessor(): StaticVBAccessor;
         vertexRow: number;
         vertexCol: number;
-        constructor(vertexFormat?: gfx.Attribute[], accessor?: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor | null);
+        constructor(vertexFormat?: gfx.Attribute[], accessor?: StaticVBAccessor | null);
         resize(vertexCount: number, indexCount: number): void;
         updateSize(vertexCount: number, indexCount: number): void;
         /** @mangle */
         protected setRenderDrawInfoAttributes(): void;
         /**
          * @internal
          * @mangle
          */
-        fillDrawInfoAttributes(drawInfo: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfo): void;
+        fillDrawInfoAttributes(drawInfo: RenderDrawInfo): void;
         /** @mangle */
         protected syncRender2dBuffer(): void;
         resizeAndCopy(vertexCount: number, indexCount: number): void;
         getMeshBuffer(): MeshBuffer | null;
@@ -3471,9 +3471,9 @@
         updateTexture(frame: SpriteFrame | __private._cocos_asset_assets_texture_base__TextureBase): void;
         updateHash(): void;
         updateRenderData(comp: UIRenderer, frame: SpriteFrame | __private._cocos_asset_assets_texture_base__TextureBase): void;
         clear(): void;
-        static createStaticVBAccessor(attributes: gfx.Attribute[], vCount?: number, iCount?: number): __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
+        static createStaticVBAccessor(attributes: gfx.Attribute[], vCount?: number, iCount?: number): StaticVBAccessor;
     }
     /**
      * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
      */
@@ -3525,113 +3525,43 @@
         protected _initIAInfo(device: gfx.Device): void;
         protected _reallocBuffer(vCount: number, iCount: number): void;
         setRenderDrawInfoAttributes(): void;
     }
-    /**
-     * @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;
-        resetAssemblerData?(data: any): void;
-        removeData?(data: BaseRenderData): void;
+    export interface IBatcher {
+        currBufferAccessor: StaticVBAccessor;
+        readonly batches: memop.CachedArray<__private._cocos_2d_renderer_draw_batch__DrawBatch2D>;
+        currStaticRoot: UIStaticBatch | null;
+        currIsStatic: boolean;
+        device: gfx.Device;
+        initialize(): boolean;
+        destroy(): void;
+        addScreen(comp: RenderRoot2D): void;
+        getFirstRenderCamera(node: Node): renderer.scene.Camera | null;
+        removeScreen(comp: RenderRoot2D): void;
+        sortScreens(): void;
+        update(): void;
+        uploadBuffers(): void;
+        reset(): void;
+        switchBufferAccessor(attributes?: gfx.Attribute[]): StaticVBAccessor;
+        commitComp(comp: UIRenderer, renderData: BaseRenderData | null, textureOrFrame: __private._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: StaticVBAccessor): void;
+        endStaticBatch(): void;
+        commitStaticBatch(comp: UIStaticBatch): void;
+        autoMergeBatches(renderComp?: UIRenderer): void;
+        forceMergeBatches(material: Material, textureOrFrame: __private._cocos_asset_assets_texture_base__TextureBase | SpriteFrame | null, renderComp: UIRenderer): void;
+        finishMergeBatches(): void;
+        flushMaterial(mat: Material): void;
+        walk(node: Node, level?: number): void;
     }
     /**
-     * @internal
-     */
-    export interface IAssemblerManager {
-        getAssembler(component: UIRenderer): IAssembler;
-    }
-    export namespace UIVertexFormat {
-        /**
-         * @en Get total components count for all attributes per vertex.
-         * @zh 获取每个顶点上所有属性的分量数总和
-         * @param attrs All attributes of the vertex format
-         * @returns Total components count
-         */
-        export function getComponentPerVertex(attrs: gfx.Attribute[]): number;
-        /**
-         * @en Get total stride for all attributes per vertex.
-         * @zh 获取每个顶点上所有属性的总步进
-         * @param attrs All attributes of the vertex format
-         * @returns Total stride
-         */
-        export function getAttributeStride(attrs: gfx.Attribute[]): number;
-        /**
-         * @en Vertex format with vector 3 position attribute
-         * @zh 包含三维位置属性的顶点格式
-         */
-        export const vfmt: gfx.Attribute[];
-        /**
-         * @en Vertex format with the following layout.
-         * 1. Vector 3 position attribute (Float32)
-         * 2. Vector 4 color attribute (Float32)
-         * @zh 包含以下数据的顶点格式
-         * 1. 三维位置属性(Float32)
-         * 2. RGBA 颜色属性(Float32)
-         */
-        export const vfmtPosColor: gfx.Attribute[];
-        /**
-         * @en Vertex format with the following layout
-         * 1. Vector 3 position attribute (Float32)
-         * 2. Vector 2 uv attribute (Float32)
-         * 3. Vector 4 color attribute (Float32)
-         * @zh 包含以下数据的顶点格式
-         * 1. 三维位置属性(Float32)
-         * 2. 二维贴图 UV 属性(Float32)
-         * 3. RGBA 颜色属性(Float32)
-         */
-        export const vfmtPosUvColor: gfx.Attribute[];
-        /**
-         * @en Vertex format with the following layout
-         * 1. Vector 3 position attribute (Float32)
-         * 2. Vector 2 uv attribute (Float32)
-         * 3. Byte 4 color attribute (Byte)
-         * @zh 包含以下数据的顶点格式
-         * 1. 三维位置属性(Float32)
-         * 2. 二维贴图 UV 属性(Float32)
-         * 3. RGBA 颜色属性(Byte)
-         */
-        export const vfmtPosUvColor4B: gfx.Attribute[];
-        /**
-         * @en Vertex format with the following layout
-         * 1. Vector 3 position attribute (Float32)
-         * 2. Vector 2 uv attribute (Float32)
-         * 3. First vector 4 color attribute (Float32)
-         * 4. Second vector 4 color attribute (Float32)
-         * @zh 包含以下数据的顶点格式
-         * 1. 三维位置属性(Float32)
-         * 2. 二维贴图 UV 属性(Float32)
-         * 3. 第一套 RGBA 颜色属性(Float32)
-         * 4. 第二套 RGBA 颜色属性(Float32)
-         */
-        export const vfmtPosUvTwoColor: gfx.Attribute[];
-        /**
-         * @en Vertex format with the following layout
-         * 1. Vector 3 position attribute (Float32)
-         * 2. Vector 2 uv attribute (Float32)
-         * 3. First byte 4 color attribute (Byte)
-         * 4. Second byte 4 color attribute (Byte)
-         * @zh 包含以下数据的顶点格式
-         * 1. 三维位置属性(Float32)
-         * 2. 二维贴图 UV 属性(Float32)
-         * 3. 第一套 RGBA 颜色属性(Byte)
-         * 4. 第二套 RGBA 颜色属性(Byte)
-         */
-        export const vfmtPosUvTwoColor4B: gfx.Attribute[];
-    }
-    /**
      * @en UI rendering process
      * @zh UI 渲染流程
      */
-    export class UI implements __private._cocos_2d_renderer_i_batcher__IBatcher {
+    export class Batcher2D implements IBatcher {
         protected _nativeObj: __private._cocos_2d_renderer_native_2d__NativeBatcher2d;
         get nativeObj(): __private._cocos_2d_renderer_native_2d__NativeBatcher2d;
-        get currBufferAccessor(): __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
+        get currBufferAccessor(): StaticVBAccessor;
         get batches(): memop.CachedArray<__private._cocos_2d_renderer_draw_batch__DrawBatch2D>;
         set currStaticRoot(value: UIStaticBatch | null);
         /**
          * @deprecated since v3.8.7
@@ -3669,10 +3599,10 @@
          * @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;
+        switchBufferAccessor(attributes?: gfx.Attribute[]): StaticVBAccessor;
+        registerBufferAccessor(key: number, accessor: StaticVBAccessor): void;
         updateBuffer(attributes: gfx.Attribute[], bid: number): void;
         /**
          * @en
          * Render component data submission process of UI.
@@ -3732,9 +3662,9 @@
          * @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;
+        setupStaticBatch(staticComp: UIStaticBatch, bufferAccessor: StaticVBAccessor): void;
         endStaticBatch(): void;
         /**
          * @en
          * Submit separate render data.
@@ -3786,9 +3716,260 @@
         flushMaterial(mat: Material): void;
         walk(node: Node, level?: number): void;
         syncMeshBuffersToNative(accId: number, buffers: MeshBuffer[]): void;
     }
+    export class StaticVBAccessor extends __private._cocos_2d_renderer_buffer_accessor__BufferAccessor {
+        static IB_SCALE: number;
+        static ID_COUNT: number;
+        get id(): number;
+        constructor(device: gfx.Device, attributes: gfx.Attribute[], vCount?: number, iCount?: number);
+        destroy(): void;
+        reset(): void;
+        getVertexBuffer(bid: number): Float32Array;
+        getIndexBuffer(bid: number): Uint16Array;
+        getMeshBuffer(bid: number): MeshBuffer;
+        uploadBuffers(): void;
+        appendIndices(bufferId: number, indices: Uint16Array): void;
+        allocateChunk(vertexCount: number, indexCount: number): StaticVBChunk | null;
+        recycleChunk(chunk: StaticVBChunk): void;
+        static generateID(): number;
+    }
     /**
+     * @internal
+     */
+    export class StaticVBChunk {
+        vertexAccessor: StaticVBAccessor;
+        bufferId: number;
+        meshBuffer: MeshBuffer;
+        vertexOffset: number;
+        vb: Float32Array;
+        indexCount: number;
+        get ib(): Readonly<Uint16Array>;
+        constructor(vertexAccessor: StaticVBAccessor, bufferId: number, meshBuffer: MeshBuffer, vertexOffset: number, vb: Float32Array, indexCount: number);
+        setIndexBuffer(indices: ArrayLike<number>): void;
+    }
+    /** @mangle */
+    export class RenderDrawInfo {
+        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 _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: RenderDrawInfoType;
+        protected _subNode: Node | null;
+        protected _nativeObj: __private._cocos_2d_renderer_native_2d__NativeRenderDrawInfo;
+        protected _uint8SharedBuffer: Uint8Array;
+        protected _uint16SharedBuffer: Uint16Array;
+        protected _uint32SharedBuffer: Uint32Array;
+        protected _render2dBuffer: Float32Array | null;
+        constructor(nativeDrawInfo?: __private._cocos_2d_renderer_native_2d__NativeRenderDrawInfo);
+        get nativeObj(): __private._cocos_2d_renderer_native_2d__NativeRenderDrawInfo;
+        get render2dBuffer(): Float32Array | null;
+        clear(): void;
+        setAccId(accId: number): void;
+        setBufferId(bufferId: number): void;
+        setAccAndBuffer(accId: number, bufferId: number): void;
+        setVertexOffset(vertexOffset: number): void;
+        setIndexOffset(indexOffset: number): void;
+        setVB(vbBuffer: Float32Array): void;
+        setIB(ibBuffer: Uint16Array): void;
+        setVData(vDataBuffer: ArrayBufferLike): void;
+        setIData(iDataBuffer: ArrayBufferLike): void;
+        setVBCount(vbCount: number): void;
+        setIBCount(ibCount: number): void;
+        setVertDirty(val: boolean): void;
+        setDataHash(dataHash: number): void;
+        setIsMeshBuffer(isMeshBuffer: boolean): void;
+        setVertexPositionInWorld(isVertexPositionInWorld: boolean): void;
+        setMaterial(material: Material): void;
+        setTexture(texture: gfx.Texture | null): void;
+        setSampler(sampler: gfx.Sampler | null): void;
+        setModel(model: renderer.scene.Model): void;
+        setDrawInfoType(drawInfoType: RenderDrawInfoType): void;
+        setSubNode(node: Node): void;
+        setStride(stride: number): void;
+        initRender2dBuffer(): void;
+        fillRender2dBuffer(vertexDataArr: IRenderData[]): void;
+    }
+    export enum RenderDrawInfoType {
+        COMP = 0,
+        MODEL = 1,
+        MIDDLEWARE = 2,
+        SUB_NODE = 3
+    }
+    /** @mangle */
+    export class RenderEntity {
+        protected _node: Node | null;
+        protected _renderTransform: Node | null;
+        protected _stencilStage: Stage;
+        protected _colorDirty: boolean;
+        protected _enabled: boolean;
+        protected _useLocal: boolean;
+        protected _maskMode: __private._cocos_2d_renderer_render_entity__MaskMode;
+        protected _uint32SharedBuffer: Uint32Array;
+        protected _uint8SharedBuffer: Uint8Array;
+        protected _boolSharedBuffer: Uint8Array;
+        get nativeObj(): __private._cocos_2d_renderer_native_2d__NativeRenderEntity;
+        get renderDrawInfoArr(): RenderDrawInfo[];
+        get renderEntityType(): RenderEntityType;
+        setPriority(val: number): void;
+        protected _color: math.Color;
+        get color(): math.Color;
+        set color(val: math.Color);
+        get colorDirty(): boolean;
+        set colorDirty(val: boolean);
+        get enabled(): boolean;
+        set enabled(val: boolean);
+        setUseLocal(useLocal: boolean): void;
+        constructor(entityType: RenderEntityType);
+        addDynamicRenderDrawInfo(renderDrawInfo: RenderDrawInfo | null): void;
+        removeDynamicRenderDrawInfo(): void;
+        clearDynamicRenderDrawInfos(): void;
+        clearStaticRenderDrawInfos(): void;
+        clearRenderDrawInfos(): void;
+        setDynamicRenderDrawInfo(renderDrawInfo: RenderDrawInfo | null, index: number): void;
+        setMaskMode(mode: __private._cocos_2d_renderer_render_entity__MaskMode): void;
+        setFillColorType(fillColorType: RenderEntityFillColorType): void;
+        getStaticRenderDrawInfo(): RenderDrawInfo | null;
+        setNode(node: Node | null): void;
+        setRenderTransform(renderTransform: Node | null): void;
+        setStencilStage(stage: Stage): void;
+    }
+    export enum RenderEntityType {
+        STATIC = 0,
+        DYNAMIC = 1,
+        CROSSED = 2
+    }
+    export enum RenderEntityFillColorType {
+        COLOR = 0,
+        VERTEX = 1
+    }
+    /**
+     * @en Stencil stage types enum.
+     * @zh 模板状态类型枚举。
+     * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
+     */
+    export enum Stage {
+        DISABLED = 0,
+        CLEAR = 1,
+        ENTER_LEVEL = 2,
+        ENABLED = 3,
+        EXIT_LEVEL = 4,
+        CLEAR_INVERTED = 5,
+        ENTER_LEVEL_INVERTED = 6
+    }
+    /**
+     * @internal
+     */
+    export interface IAssembler {
+        createData?(comp: UIRenderer): BaseRenderData;
+        fillBuffers?(comp: UIRenderer, renderer: IBatcher): void;
+        updateUVs?(comp: UIRenderer, ...args: any[]): void;
+        updateColor?(comp: UIRenderer): void;
+        updateRenderData?(comp: UIRenderer): void;
+        update?(comp: UIRenderer, dt: number): void;
+        resetAssemblerData?(data: any): void;
+        removeData?(data: BaseRenderData): void;
+    }
+    /**
+     * @internal
+     */
+    export interface IAssemblerManager {
+        getAssembler(component: UIRenderer): IAssembler;
+    }
+    export namespace UIVertexFormat {
+        /**
+         * @en Get total components count for all attributes per vertex.
+         * @zh 获取每个顶点上所有属性的分量数总和
+         * @param attrs All attributes of the vertex format
+         * @returns Total components count
+         */
+        export function getComponentPerVertex(attrs: gfx.Attribute[]): number;
+        /**
+         * @en Get total stride for all attributes per vertex.
+         * @zh 获取每个顶点上所有属性的总步进
+         * @param attrs All attributes of the vertex format
+         * @returns Total stride
+         */
+        export function getAttributeStride(attrs: gfx.Attribute[]): number;
+        /**
+         * @en Vertex format with vector 3 position attribute
+         * @zh 包含三维位置属性的顶点格式
+         */
+        export const vfmt: gfx.Attribute[];
+        /**
+         * @en Vertex format with the following layout.
+         * 1. Vector 3 position attribute (Float32)
+         * 2. Vector 4 color attribute (Float32)
+         * @zh 包含以下数据的顶点格式
+         * 1. 三维位置属性(Float32)
+         * 2. RGBA 颜色属性(Float32)
+         */
+        export const vfmtPosColor: gfx.Attribute[];
+        /**
+         * @en Vertex format with the following layout
+         * 1. Vector 3 position attribute (Float32)
+         * 2. Vector 2 uv attribute (Float32)
+         * 3. Vector 4 color attribute (Float32)
+         * @zh 包含以下数据的顶点格式
+         * 1. 三维位置属性(Float32)
+         * 2. 二维贴图 UV 属性(Float32)
+         * 3. RGBA 颜色属性(Float32)
+         */
+        export const vfmtPosUvColor: gfx.Attribute[];
+        /**
+         * @en Vertex format with the following layout
+         * 1. Vector 3 position attribute (Float32)
+         * 2. Vector 2 uv attribute (Float32)
+         * 3. Byte 4 color attribute (Byte)
+         * @zh 包含以下数据的顶点格式
+         * 1. 三维位置属性(Float32)
+         * 2. 二维贴图 UV 属性(Float32)
+         * 3. RGBA 颜色属性(Byte)
+         */
+        export const vfmtPosUvColor4B: gfx.Attribute[];
+        /**
+         * @en Vertex format with the following layout
+         * 1. Vector 3 position attribute (Float32)
+         * 2. Vector 2 uv attribute (Float32)
+         * 3. First vector 4 color attribute (Float32)
+         * 4. Second vector 4 color attribute (Float32)
+         * @zh 包含以下数据的顶点格式
+         * 1. 三维位置属性(Float32)
+         * 2. 二维贴图 UV 属性(Float32)
+         * 3. 第一套 RGBA 颜色属性(Float32)
+         * 4. 第二套 RGBA 颜色属性(Float32)
+         */
+        export const vfmtPosUvTwoColor: gfx.Attribute[];
+        /**
+         * @en Vertex format with the following layout
+         * 1. Vector 3 position attribute (Float32)
+         * 2. Vector 2 uv attribute (Float32)
+         * 3. First byte 4 color attribute (Byte)
+         * 4. Second byte 4 color attribute (Byte)
+         * @zh 包含以下数据的顶点格式
+         * 1. 三维位置属性(Float32)
+         * 2. 二维贴图 UV 属性(Float32)
+         * 3. 第一套 RGBA 颜色属性(Byte)
+         * 4. 第二套 RGBA 颜色属性(Byte)
+         */
+        export const vfmtPosUvTwoColor4B: gfx.Attribute[];
+    }
+    /**
      * @deprecated since v3.6.0, this is an engine private interface that will be removed in the future.
      * @internal
      */
     export class UIDrawBatch extends __private._cocos_2d_renderer_draw_batch__DrawBatch2D {
@@ -7882,9 +8063,9 @@
         /**
          * @en The draw batch manager for 2D UI, for engine internal usage, user do not need to use this.
          * @zh 2D UI 渲染合批管理器,引擎内部使用,用户无需使用此接口
          */
-        get batcher2D(): UI;
+        get batcher2D(): Batcher2D;
         /**
          * @en Render scenes list
          * @zh 渲染场景列表
          */
@@ -38300,9 +38481,9 @@
              * @zh 自定义材质。
              */
             get customMaterial(): Material | null;
             set customMaterial(val: Material | null);
-            protected _render(batcher: UI): void;
+            protected _render(batcher: Batcher2D): void;
             __preload(): void;
             /**
              * @en Initialize asset data and internal data within the component.
              * @zh 初始化资产数据以及组件内部数据。
@@ -38543,9 +38724,9 @@
              */
             armature(): Armature | null;
             protected _flushAssembler(): void;
             protected _updateSocketBindings(): void;
-            protected createRenderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
+            protected createRenderEntity(): RenderEntity;
             /**
              * @en Sets flag for update render data.
              * @zh 标记组件渲染数据更新。
              */
@@ -46407,9 +46588,9 @@
          * @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 _render(render: IBatcher): void;
         protected _updatePositionType(): void;
     }
     /**
      * @en
@@ -46487,9 +46668,9 @@
         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;
+        _render(render: IBatcher): void;
     }
     export const MotionStreakAssemblerManager: IAssemblerManager;
     export const ParticleSystem2DAssembler: IAssemblerManager;
     /**
@@ -53706,9 +53887,9 @@
             updateAnimation(dt: number): void;
             protected _updateCache(dt: number): void;
             protected _emitCacheCompleteEvent(): void;
             protected _flushAssembler(): void;
-            protected _render(batcher: UI): void;
+            protected _render(batcher: Batcher2D): void;
             protected _updateBuiltinMaterial(): Material;
             protected _updateAnimEnum(): void;
             protected _updateSkinEnum(): void;
             protected _refreshInspector(): void;
@@ -53716,9 +53897,9 @@
              * @en Call this method to destroy the rendering data.
              * @zh 调用该方法销毁渲染数据。
              */
             destroyRenderData(): void;
-            protected createRenderEntity(): __private._cocos_2d_renderer_render_entity__RenderEntity;
+            protected createRenderEntity(): RenderEntity;
             /**
              * @en Mark to re-update the rendering data, usually used to force refresh the display.
              * @zh 标记重新更新渲染数据,一般用于强制刷新显示。
              */
@@ -55461,10 +55642,10 @@
          * 网格渲染数据数组的索引
          * @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;
+        protected _render(ui: IBatcher): void;
+        protected createRenderEntity(): RenderEntity;
         prepareDrawData(): void;
     }
     /**
      * @en Renders the TMX object group.
@@ -62828,22 +63009,8 @@
             setDirty(): any;
             recycleIA(): any;
             uploadBuffers(): any;
         }
-        /**
-         * @en Stencil stage types enum.
-         * @zh 模板状态类型枚举。
-         * @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
-         */
-        export enum _cocos_2d_renderer_stencil_manager__Stage {
-            DISABLED = 0,
-            CLEAR = 1,
-            ENTER_LEVEL = 2,
-            ENABLED = 3,
-            EXIT_LEVEL = 4,
-            CLEAR_INVERTED = 5,
-            ENTER_LEVEL_INVERTED = 6
-        }
         export interface _cocos_2d_assets_sprite_atlas__ISpriteFrameList {
             [key: string]: SpriteFrame | null;
         }
         /**
@@ -63368,260 +63535,8 @@
             nuv: number[];
             minPos: math.Vec3;
             maxPos: math.Vec3;
         }
-        /**
-         * @internal
-         */
-        export class _cocos_2d_renderer_static_vb_accessor__StaticVBChunk {
-            vertexAccessor: _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
-            bufferId: number;
-            meshBuffer: MeshBuffer;
-            vertexOffset: number;
-            vb: Float32Array;
-            indexCount: number;
-            get ib(): Readonly<Uint16Array>;
-            constructor(vertexAccessor: _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor, bufferId: number, meshBuffer: MeshBuffer, vertexOffset: number, vb: Float32Array, indexCount: number);
-            setIndexBuffer(indices: ArrayLike<number>): void;
-        }
-        export class _cocos_2d_renderer_buffer_accessor__BufferAccessor {
-            get attributes(): Readonly<gfx.Attribute[]>;
-            get vertexFormatBytes(): number;
-            get floatsPerVertex(): number;
-            protected _device: gfx.Device;
-            protected _attributes: gfx.Attribute[];
-            protected _vertexFormatBytes: number;
-            protected _floatsPerVertex: number;
-            protected _buffers: MeshBuffer[];
-            constructor(device: gfx.Device, attributes: gfx.Attribute[]);
-            initialize(): void;
-            reset(): void;
-            request(vertexCount?: number, indexCount?: number): void;
-            appendBuffers(vertices: Float32Array, indices: Uint16Array): void;
-            uploadBuffers(): void;
-            destroy(): void;
-        }
-        export class _cocos_2d_renderer_static_vb_accessor__StaticVBAccessor extends _cocos_2d_renderer_buffer_accessor__BufferAccessor {
-            static IB_SCALE: number;
-            static ID_COUNT: number;
-            get id(): number;
-            constructor(device: gfx.Device, attributes: gfx.Attribute[], vCount?: number, iCount?: number);
-            destroy(): void;
-            reset(): void;
-            getVertexBuffer(bid: number): Float32Array;
-            getIndexBuffer(bid: number): Uint16Array;
-            getMeshBuffer(bid: number): MeshBuffer;
-            uploadBuffers(): void;
-            appendIndices(bufferId: number, indices: Uint16Array): void;
-            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;
-            getFirstRenderCamera(node: Node): renderer.scene.Camera | null;
-            removeScreen(comp: RenderRoot2D): void;
-            sortScreens(): void;
-            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 class _cocos_2d_renderer_native_2d__NativeRenderDrawInfo {
-            constructor();
-            get vbBuffer(): ArrayBufferLike;
-            set vbBuffer(vbBuffer: ArrayBufferLike);
-            get ibBuffer(): ArrayBufferLike;
-            set ibBuffer(ibBuffer: ArrayBufferLike);
-            get vDataBuffer(): ArrayBufferLike;
-            set vDataBuffer(vDataBuffer: ArrayBufferLike);
-            get iDataBuffer(): ArrayBufferLike;
-            set iDataBuffer(iDataBuffer: ArrayBufferLike);
-            get material(): Material | null;
-            set material(material: Material | null);
-            get texture(): gfx.Texture | null;
-            set texture(texture: gfx.Texture | null);
-            get sampler(): gfx.Sampler | null;
-            set sampler(sampler: gfx.Sampler | null);
-            get model(): renderer.scene.Model | null;
-            set model(model: renderer.scene.Model | null);
-            get subNode(): Node;
-            set subNode(node: Node);
-            changeMeshBuffer(): any;
-            setRender2dBufferToNative(data: __types_globals__TypedArray): any;
-            syncSharedBufferToNative(data: __types_globals__TypedArray): any;
-            getAttrSharedBufferForJS(): ArrayBufferLike;
-        }
-        export class _cocos_2d_renderer_native_2d__NativeRenderEntity {
-            constructor(type: number);
-            addDynamicRenderDrawInfo(drawInfo: _cocos_2d_renderer_native_2d__NativeRenderDrawInfo): any;
-            setDynamicRenderDrawInfo(drawInfo: _cocos_2d_renderer_native_2d__NativeRenderDrawInfo, index: number): any;
-            removeDynamicRenderDrawInfo(): any;
-            clearDynamicRenderDrawInfos(): any;
-            clearStaticRenderDrawInfos(): any;
-            get node(): Node | null;
-            set node(node: Node | null);
-            get renderTransform(): Node | null;
-            set renderTransform(node: Node | null);
-            get stencilStage(): number;
-            set stencilStage(stage: number);
-            get staticDrawInfoSize(): number;
-            set staticDrawInfoSize(size: number);
-            getStaticRenderDrawInfo(index: number): _cocos_2d_renderer_native_2d__NativeRenderDrawInfo;
-            getEntitySharedBufferForJS(): ArrayBufferLike;
-        }
-        export enum _cocos_2d_renderer_render_draw_info__RenderDrawInfoType {
-            COMP = 0,
-            MODEL = 1,
-            MIDDLEWARE = 2,
-            SUB_NODE = 3
-        }
-        /** @mangle */
-        export class _cocos_2d_renderer_render_draw_info__RenderDrawInfo {
-            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 _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 _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;
-            clear(): void;
-            setAccId(accId: number): void;
-            setBufferId(bufferId: number): void;
-            setAccAndBuffer(accId: number, bufferId: number): void;
-            setVertexOffset(vertexOffset: number): void;
-            setIndexOffset(indexOffset: number): void;
-            setVB(vbBuffer: Float32Array): void;
-            setIB(ibBuffer: Uint16Array): void;
-            setVData(vDataBuffer: ArrayBufferLike): void;
-            setIData(iDataBuffer: ArrayBufferLike): void;
-            setVBCount(vbCount: number): void;
-            setIBCount(ibCount: number): void;
-            setVertDirty(val: boolean): void;
-            setDataHash(dataHash: number): void;
-            setIsMeshBuffer(isMeshBuffer: boolean): void;
-            setVertexPositionInWorld(isVertexPositionInWorld: boolean): void;
-            setMaterial(material: Material): void;
-            setTexture(texture: gfx.Texture | null): void;
-            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;
-            setStride(stride: number): void;
-            initRender2dBuffer(): void;
-            fillRender2dBuffer(vertexDataArr: IRenderData[]): void;
-        }
-        export enum _cocos_2d_renderer_render_entity__RenderEntityType {
-            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;
-            protected _stencilStage: _cocos_2d_renderer_stencil_manager__Stage;
-            protected _colorDirty: boolean;
-            protected _enabled: boolean;
-            protected _useLocal: boolean;
-            protected _maskMode: _cocos_2d_renderer_render_entity__MaskMode;
-            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[];
-            get renderEntityType(): _cocos_2d_renderer_render_entity__RenderEntityType;
-            setPriority(val: number): void;
-            protected _color: math.Color;
-            get color(): math.Color;
-            set color(val: math.Color);
-            get colorDirty(): boolean;
-            set colorDirty(val: boolean);
-            get enabled(): boolean;
-            set enabled(val: boolean);
-            setUseLocal(useLocal: boolean): void;
-            constructor(entityType: _cocos_2d_renderer_render_entity__RenderEntityType);
-            addDynamicRenderDrawInfo(renderDrawInfo: _cocos_2d_renderer_render_draw_info__RenderDrawInfo | null): void;
-            removeDynamicRenderDrawInfo(): void;
-            clearDynamicRenderDrawInfos(): void;
-            clearStaticRenderDrawInfos(): void;
-            clearRenderDrawInfos(): void;
-            setDynamicRenderDrawInfo(renderDrawInfo: _cocos_2d_renderer_render_draw_info__RenderDrawInfo | null, index: number): void;
-            setMaskMode(mode: _cocos_2d_renderer_render_entity__MaskMode): void;
-            setFillColorType(fillColorType: _cocos_2d_renderer_render_entity__RenderEntityFillColorType): void;
-            getStaticRenderDrawInfo(): _cocos_2d_renderer_render_draw_info__RenderDrawInfo | null;
-            setNode(node: Node | null): void;
-            setRenderTransform(renderTransform: Node | null): void;
-            setStencilStage(stage: _cocos_2d_renderer_stencil_manager__Stage): void;
-        }
         export enum _cocos_2d_framework_sprite_renderer__SpriteMode {
             SIMPLE = 0,
             SLICED = 1,
             TILED = 2
@@ -63733,8 +63648,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: 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;
@@ -63962,8 +63895,75 @@
             reset(): any;
             syncRootNodesToNative(nodes: Node[]): any;
             releaseDescriptorSetCache(texture: gfx.Texture, sampler: gfx.Sampler): any;
         }
+        export class _cocos_2d_renderer_buffer_accessor__BufferAccessor {
+            get attributes(): Readonly<gfx.Attribute[]>;
+            get vertexFormatBytes(): number;
+            get floatsPerVertex(): number;
+            protected _device: gfx.Device;
+            protected _attributes: gfx.Attribute[];
+            protected _vertexFormatBytes: number;
+            protected _floatsPerVertex: number;
+            protected _buffers: MeshBuffer[];
+            constructor(device: gfx.Device, attributes: gfx.Attribute[]);
+            initialize(): void;
+            reset(): void;
+            request(vertexCount?: number, indexCount?: number): void;
+            appendBuffers(vertices: Float32Array, indices: Uint16Array): void;
+            uploadBuffers(): void;
+            destroy(): void;
+        }
+        export class _cocos_2d_renderer_native_2d__NativeRenderDrawInfo {
+            constructor();
+            get vbBuffer(): ArrayBufferLike;
+            set vbBuffer(vbBuffer: ArrayBufferLike);
+            get ibBuffer(): ArrayBufferLike;
+            set ibBuffer(ibBuffer: ArrayBufferLike);
+            get vDataBuffer(): ArrayBufferLike;
+            set vDataBuffer(vDataBuffer: ArrayBufferLike);
+            get iDataBuffer(): ArrayBufferLike;
+            set iDataBuffer(iDataBuffer: ArrayBufferLike);
+            get material(): Material | null;
+            set material(material: Material | null);
+            get texture(): gfx.Texture | null;
+            set texture(texture: gfx.Texture | null);
+            get sampler(): gfx.Sampler | null;
+            set sampler(sampler: gfx.Sampler | null);
+            get model(): renderer.scene.Model | null;
+            set model(model: renderer.scene.Model | null);
+            get subNode(): Node;
+            set subNode(node: Node);
+            changeMeshBuffer(): any;
+            setRender2dBufferToNative(data: __types_globals__TypedArray): any;
+            syncSharedBufferToNative(data: __types_globals__TypedArray): any;
+            getAttrSharedBufferForJS(): ArrayBufferLike;
+        }
+        export enum _cocos_2d_renderer_render_entity__MaskMode {
+            NONE = 0,
+            MASK = 1,
+            MASK_INVERTED = 2,
+            MASK_NODE = 3,
+            MASK_NODE_INVERTED = 4
+        }
+        export class _cocos_2d_renderer_native_2d__NativeRenderEntity {
+            constructor(type: number);
+            addDynamicRenderDrawInfo(drawInfo: _cocos_2d_renderer_native_2d__NativeRenderDrawInfo): any;
+            setDynamicRenderDrawInfo(drawInfo: _cocos_2d_renderer_native_2d__NativeRenderDrawInfo, index: number): any;
+            removeDynamicRenderDrawInfo(): any;
+            clearDynamicRenderDrawInfos(): any;
+            clearStaticRenderDrawInfos(): any;
+            get node(): Node | null;
+            set node(node: Node | null);
+            get renderTransform(): Node | null;
+            set renderTransform(node: Node | null);
+            get stencilStage(): number;
+            set stencilStage(stage: number);
+            get staticDrawInfoSize(): number;
+            set staticDrawInfoSize(size: number);
+            getStaticRenderDrawInfo(index: number): _cocos_2d_renderer_native_2d__NativeRenderDrawInfo;
+            getEntitySharedBufferForJS(): ArrayBufferLike;
+        }
         export class _cocos_2d_utils_dynamic_atlas_atlas__DynamicAtlasTexture extends Texture2D {
             /**
              * @en
              * Initialize the render texture.
@@ -75867,8 +75867,8 @@
     import { exoticAnimationTag, ExoticAnimation, additiveSettingsTag, AnimationClipAdditiveSettings } from "cc/editor/exotic-animation";
     import { EmbeddedPlayer, embeddedPlayerCountTag, getEmbeddedPlayersTag, addEmbeddedPlayerTag, removeEmbeddedPlayerTag, clearEmbeddedPlayersTag } from "cc/editor/embedded-player";
     import { AnimationMask, __private as ___private } from "cc/editor/new-gen-anim";
     import { CCON } from "cc/editor/serialization";
-    export { Canvas as CanvasComponent, UIRenderer as RenderComponent, UIRenderer as UIRenderable, UIRenderer as Renderable2D, UITransform as UITransformComponent, Sprite as SpriteComponent, UIMeshRenderer as UIModelComponent, LabelOutline as LabelOutlineComponent, UIStaticBatch as UIStaticBatchComponent, UIOpacity as UIOpacityComponent, Label as LabelComponent, MaskComponent as Mask, RichTextComponent as RichText, GraphicsComponent as Graphics, MeshRenderer as ModelComponent, DirectionalLight as DirectionalLightComponent, Light as LightComponent, SphereLight as SphereLightComponent, SpotLight as SpotLightComponent, SkinnedMeshRenderer as SkinningModelComponent, SkinnedMeshBatchRenderer as BatchedSkinningModelComponent, SkinnedMeshUnit as SkinningModelUnit, Animation as AnimationComponent, AudioSource as AudioSourceComponent, Node as BaseNode, Camera as CameraComponent, ModelRenderer as RenderableComponent, Billboard as BillboardComponent, Line as LineComponent, ParticleSystem as ParticleSystemComponent, SkeletalAnimation as SkeletalAnimationComponent, Button as ButtonComponent, EditBox as EditBoxComponent, Layout as LayoutComponent, ProgressBar as ProgressBarComponent, ScrollBar as ScrollBarComponent, ScrollView as ScrollViewComponent, Slider as SliderComponent, Toggle as ToggleComponent, ToggleContainer as ToggleContainerComponent, Widget as WidgetComponent, PageView as PageViewComponent, PageViewIndicator as PageViewIndicatorComponent, SafeArea as SafeAreaComponent, UICoordinateTracker as UICoordinateTrackerComponent, BlockInputEvents as BlockInputEventsComponent } from "cc";
+    export { Canvas as CanvasComponent, UIRenderer as RenderComponent, UIRenderer as UIRenderable, UIRenderer as Renderable2D, UITransform as UITransformComponent, Sprite as SpriteComponent, UIMeshRenderer as UIModelComponent, LabelOutline as LabelOutlineComponent, UIStaticBatch as UIStaticBatchComponent, UIOpacity as UIOpacityComponent, Label as LabelComponent, MaskComponent as Mask, RichTextComponent as RichText, GraphicsComponent as Graphics, Batcher2D as UI, MeshRenderer as ModelComponent, DirectionalLight as DirectionalLightComponent, Light as LightComponent, SphereLight as SphereLightComponent, SpotLight as SpotLightComponent, SkinnedMeshRenderer as SkinningModelComponent, SkinnedMeshBatchRenderer as BatchedSkinningModelComponent, SkinnedMeshUnit as SkinningModelUnit, Animation as AnimationComponent, AudioSource as AudioSourceComponent, Node as BaseNode, Camera as CameraComponent, ModelRenderer as RenderableComponent, Billboard as BillboardComponent, Line as LineComponent, ParticleSystem as ParticleSystemComponent, SkeletalAnimation as SkeletalAnimationComponent, Button as ButtonComponent, EditBox as EditBoxComponent, Layout as LayoutComponent, ProgressBar as ProgressBarComponent, ScrollBar as ScrollBarComponent, ScrollView as ScrollViewComponent, Slider as SliderComponent, Toggle as ToggleComponent, ToggleContainer as ToggleContainerComponent, Widget as WidgetComponent, PageView as PageViewComponent, PageViewIndicator as PageViewIndicatorComponent, SafeArea as SafeAreaComponent, UICoordinateTracker as UICoordinateTrackerComponent, BlockInputEvents as BlockInputEventsComponent } from "cc";
     import { Details as _Details } from "cc";
     export {};
 }

finscn added 2 commits August 31, 2025 02:07
因为有时候要用到 Batcher2D 才有的方法和属性

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments (1)

  1. cocos/2d/renderer/base.ts, line 39 (link)

    style: Both Stage and StencilManager are marked @deprecated since v3.7.0 in stencil-manager.ts with warnings about being "engine private interface that will be removed in the future". Consider documenting this deprecation status for users of these exports.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant