diff --git a/docs/PORT-PLAN.md b/docs/PORT-PLAN.md index 7da62aa4..704aec1a 100644 --- a/docs/PORT-PLAN.md +++ b/docs/PORT-PLAN.md @@ -999,3 +999,48 @@ groups, independent reduced branch/leaf/frond LOD meshes, exact frond smoothing, billboard dimensions/component fades, newer SPT extension semantics, gameplay collision integration and GPU wind rendering. No DLL runtime or rendered visual parity comparison was performed. Original AVA2 data and server remain unchanged. + + +### 2026-10-12 Per-frame CPU/GPU optimization pass + +Implemented the prioritized per-frame findings, one commit per item (client +1eccdc87..121f1a63, shared sdk a1b3938..53115d9): + +- Render3D mesh cache sweeps only on growth; one shared GPU skinning palette per + instance (pushed once per change); cached part->parent bone maps. +- Text tails/labels: no per-frame codepoint vectors, show-state flag instead of + list search, memoized widths, reused painter text instance. +- Off-screen actor shadows culled; draw lists reserve last frame's peak. +- Full mip chains for GPU scene textures (visible change: distant terrain/props + no longer shimmer; sampler max_lod was zero before). +- GPU tri-groups share one resident mesh and draw index sub-ranges. +- Skins resolved once per skin change on the GPU draw cache; RenderSceneGPU + resolves each texture once and sorts opaque draws by texture handle. +- HardwareVertex packed 88 -> 48 bytes (UBYTE4_NORM colour, SHORT4_NORM normal, + UBYTE4 bones, USHORT4_NORM weights); shaders unchanged. +- Texture/mesh uploads staged and copied in the frame command buffer (one + transfer buffer and copy pass per frame). +- Every draw reads its transform from the instance storage buffer + (firstInstance = batch index); the 288-byte uniform is pushed once per frame. + Texture eviction sorts candidates once. +- Bone lookup by a cached name index; attachments cache their bone index. +- Python member-function names interned for PyCallClassMemberFunc (cache dropped + by Py_AtExit across Py_Finalize/Py_Initialize). +- Preview minimap radar redrawn only when its inputs change. + +Verified: Debug macOS/Metal build, 50/50 CTests (including new regressions for +resident index sub-ranges and GPU-cache skin changes). The current origin/main +SpeedTree forest test needs SDK APIs not present in any pushed sdk revision, so +verification used a local SDK shim; speedtree_forest_test was not built. + +Not done, by decision: removing the offscreen colour target + blit (the 3D layer +must composite premultiplied over SDL_Renderer 2D layers); baking text outlines +(SDL already batches the five quads; colour would enter the cache key); partial +palette pushes (risky on Vulkan/SPIR-V); sharing streams on the CPU-skinning +tri-group path (would churn resident buffers); a per-frame light/fog uniform +(light is per draw; fog is 32 bytes and nothing is pushed per draw any more). + +Outstanding: no Vulkan/Android device run or frame-time capture for this pass; +`frames*0.033f` / `frames/60` animation clocks are frame-based rather than real +time; translucent depth sorting uses each draw's first vertex. Original AVA2 +data and the server are unchanged.