Index of every page on this site: llms.txt
All skills
oahc09 avatar

/cocosair-performance

@ed38648
by oahc09oahc09/cocosairjs3 stars
2
Run it yourself

Optimize draw calls: static merge, instancing, dynamic atlases and GPU morph fields. Frame budgets, on-demand rendering, AIR_E_MESH_CAPACITY, AIR_E_PIXEL_RATIO_IMPORT_ORDER.

  • 12 files
  • 84.2 KB
  • MIT
  • Updated last month
  • GitHub
Use this Skill: https://skilld.dev/gh/oahc09/cocosairjs/cocosair-performance

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencestriggers.md

≈609 tokens on demand. Your agent reads this file only when SKILL.md points to it.

performance contracts triggers

“Route 1” means shared mesh/material across renderers in batching routes. Source annotations refer to the AIR checkout.

When to use what

  • "1000 identical cubes and I get 1000 draws" -> route 1 stays 1000 unless the shared material carries defines: { USE_INSTANCING: true }, then Math.ceil(1000 / 1024) = 1 draw (instancing.md).
  • "those cubes never move again" -> BatchingUtility.batchStaticModel(grid, batchedRoot) (src/cocos/3d/misc/batch-utils.ts:65), 1 draw at 256 and at 50000 quads (docs/manual/batching-recipes.md:61-62).
  • "the cube count or the vertex data changes every frame" -> utils.MeshUtils.createDynamicMesh (src/cocos/3d/misc/create-mesh.ts:419) plus Mesh.updateSubMesh (src/cocos/3d/assets/mesh.ts:588).
  • "two meshes refuse to merge" -> Mesh.validateMergingMesh (src/cocos/3d/assets/mesh.ts:1085) compares bundle count, attribute formats, primitive count and mode, and rejects a dynamic mesh before Mesh.merge (:771) returns false.
  • "how many draws did that actually save" -> profiler.showStats() and its draws row (src/cocos/profiler/profiler.ts:590); the harness asserts against the live counter instead of trusting the route name (examples/shared/batching-routes.ts:179-180).
  • "do I need a static-batch component for UI" -> no: UIStaticBatch is inert in this fork (src/cocos/2d/components/ui-static-batch.ts:85, :106), and auto-batching keys are in batching-routes.md.
  • "UI sprites with many different textures" -> the dynamic atlas acceptance rules and knob defaults in dynamic-atlas.md.
  • "my sprites stopped batching after I repainted a texture" -> texture hash is part of the batch key (src/cocos/2d/renderer/render-data.ts:460-463), so a new texture object starts a new batch even for identical pixels.
  • "is my loop actually paused" -> game.isPaused() (src/cocos/game/game.ts:615); director.isPaused() (src/cocos/game/director.ts:693) reports only the logic gate and stays false while the main loop is stopped.
  • "the device is too slow at DPR 3" -> pixelRatioCap in the app options (src/air/app.ts:81), then resolutionScale only when you accept softer text.
  • "can I trust the 50k starfield number as a budget" -> no, the recorded evidence covers visibility, interaction and release only (profiles.md).

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at ed38648. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
layer
subsystem
All 1 allowed tools
Read Edit Write Bash
Other metadata
compatibility
Cocos AIR source checkout or installed cocosair.js package. Browser rendering requires WebGL 2; source tooling requires Node.js >=18. Use the host-provided tools and user-authorized workspace.
when_to_use
[
  "draw calls equal the object count",
  "batch many static meshes or UI sprites; createAirInstanceBatch/createAirMorphField point/voxel",
  "measure actual draw counts and frame budget",
  "stop rendering until the next requested frame",
  "high pixel density makes the device too slow"
]
owns
[
  "batching",
  "instancing",
  "dynamic-atlas",
  "profiler",
  "on-demand-rendering",
  "pixel-ratio"
]
not_for
[
  "procedural geometry authoring -> cocosair-primitives-mesh",
  "startup admission and app lifecycle -> cocosair-application",
  "material property types -> cocosair-materials-effects"
]
metadata
{
  "author": "oahc09@gmail.com",
  "version": "1.0.0",
  "last-updated": "2026-10-13",
  "description_zh": "选择静态合批、动态图集和实例化,并检查性能统计、剔除和按需渲染。用于大量对象、动画或绘制性能优化。"
}

README badge

README badge for oahc09/cocosairjs/cocosair-performance