Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

chore(render): rule out the sort design for the particle gap

esenginea460877acec7
diff --git a/examples/celestial-heights/engine-gaps.mjs b/examples/celestial-heights/engine-gaps.mjs
index b57a9cf72..089e7b396 100644
--- a/examples/celestial-heights/engine-gaps.mjs
+++ b/examples/celestial-heights/engine-gaps.mjs
@@ -55,11 +55,15 @@ export const GAPS = [
+ 'also listed in ySortLayers. A draw on layer 3 is losing to one on layer 2, and '
+ 'y-sorting the lower layer makes it lose harder.',
fix:
- 'Find why a particle draw loses to a sprite on a LOWER layer. By the key it cannot: '
- + 'buildSortKey puts stage and layer above y, depth and blend, so layer 3 must draw '
- + 'after layer 2. So the next step is not the ordering rule but whether that command '
- + 'reaches the GPU at all — dump the particle DrawCommand\'s sort_key and its '
- + 'survival through DrawList, and compare against the sprite it disappears behind. '
+ 'The sorting DESIGN is not the fault, and that is now checked rather than assumed: '
+ + 'buildSortKey and buildSortKeyYSorted share their top two fields — layer at 63:48, '
+ + 'stage at 47:44 — precisely so a y-sorted layer and a plain one order against each '
+ + 'other, and the header says so. Layer 3 therefore cannot legally sort under layer '
+ + '2. So the fault is downstream of the sort: a particle draw is the one instanced '
+ + 'command in the list (layoutId ParticleInstance, instanceCount > 0, and '
+ + 'canMergeWith refuses to coalesce it), so look at submission and stream handling '
+ + 'for instanced draws. Instrument DrawList: dump each command\'s sort_key, layout '
+ + 'and instance count in submission order, and see where the particle one goes. '
+ 'Already excluded by measurement: the emitter data (identical data draws in a '
+ 'probe), burst against continuous, position, layers 2/3/4, blend mode, asset '
+ 'packaging, and — added one at a time to a probe that kept drawing — physics, a '