feat: establish formal raster particle source chain

This commit is contained in:
OpenAI Codex
2026-08-31 12:17:06 +08:00
parent 343cecc778
commit 39c7ae22ed
40 changed files with 811 additions and 130 deletions

View File

@@ -9,23 +9,21 @@
- 分支:`particle/main`
- 开始 HEAD:`1ec44701146925dec9a87618e3f90bee9a12073f`
- 平台范围:Android OpenGL;未修改 iOS、Vulkan、NavSea 或在线数据链。
- Test App 继续使用既有 `Particle Core Layer Validation` 入口;Core adapter 不依赖 Kotlin/Android UI。
- Test App 继续使用既有 `Particle Core Layer Validation` 入口,但其 Style 现在创建正式 `raster-array` source 和 `raster-particle` layer;Core adapter 不依赖 Kotlin/Android UI 或 Android asset API。
## 已实现的 Stage A 链路
```text
particle-fixtures/{uniform-east,uniform-north,vortex}
-> OfflineFixtureParticleAdapter
-> ParticleFieldSnapshot
-> GPU field texture
-> State A/B field sampling
-> Trail A/B consuming State A/B
-> canonical world composite / shared coastal mask
APK asset://integration/particle-fixtures/{uniform-east,uniform-north}/
-> RasterArraySource -> RenderRasterArraySource
-> ParticleFieldSnapshot -> GPU field texture
-> RasterParticleLayer (Source::Required) -> RenderRasterParticleLayer
-> State A/B field sampling -> Trail A/B -> canonical world composite / shared coastal mask
```
- fixture contract 使用 `metadata.json + field.f32`,校验 schema、id、WIND/GLOBAL、EPSG:4326、bounds、grid registration/order、interleaved UV、little-endian float32、NoData 声明、长度和 SHA-256。
- fixture contract 使用 `metadata.json + field.f32`,校验 schema、id、WIND/GLOBAL、EPSG:4326、bounds、grid registration/order、interleaved UV、little-endian float32、NoData 声明、长度和 SHA-256。Android asset 由 Test App 打包,Core 只接收 FileSource 返回的 metadata/field bytes;Linux helper 才读取仓库 `particle-fixtures/`。
- `uniform-east`、`uniform-north` 和 `vortex` 均为确定性 16x16 fixture;不会在每帧解析或上传。切换 fixture 时递增 `fieldGeneration/gpuFieldGeneration`,清空旧 trail;Camera 操作不触发 field upload。
- shader 的 State pass 实际采样 GPU field texture,Trail pass 从 State write texture 读取粒子位置,未使用 Kotlin/CPU 每帧粒子循环。
- shader 的 State pass 实际采样 GPU field texture,Trail pass 从 State write texture 读取粒子位置,未使用 Kotlin/CPU 每帧粒子循环。field texture alpha 表示 cell validity;NoData cell 上传为 alpha=0,State pass 在该 sample 上确定性 respawn 到 seed position,绝不将 `-9999` clamp 成速度。
- STATIC 不再因资源缺失提前返回。新的 context/resource generation 会建立 field、mask、trail 和 state;STATIC 首帧走零步 bootstrap,提交 state/trail slot 但不增加 `simulationFrame`,之后保持 frozen composite。
- Activity Bundle 保存/恢复 active、enabled、mask mode 与 fixture mode;GPU runtime state 不写入 Bundle。
@@ -33,11 +31,12 @@ particle-fixtures/{uniform-east,uniform-north,vortex}
| 检查 | 结果 |
|---|---|
| `ninja -C build-linux-opengl` 受影响 Core 对象 | PASS:`offline_fixture_particle_adapter.cpp`、`render_particle_validation_layer.cpp`、`shader_info.cpp`、`particle_validation_layer.cpp` |
| `ninja -C build-linux-opengl` 受影响 Core 对象 | PASS:正式 `raster_array_source.cpp`、`raster_particle_layer.cpp`、`raster_particle_layer_factory.cpp`、`render_source.cpp`、`RenderRasterParticleLayer` 实现、adapter 与 source conversion |
| `clang-format --dry-run --Werror` | PASS |
| `git diff --check` | PASS |
| `python3 tools/generate_particle_fixture_f32.py` 后 metadata JSON 与 SHA-256 | PASS |
| adapter smoke test | PASS:`uniform-east`、`uniform-north`、`vortex` 分别加载为 16x16 |
| adapter smoke test | PASS:`uniform-east`、`uniform-north`、`vortex` 分别加载为 16x16;`nodata` 为合法 16x16 field 且恰有 1 个 invalid cell |
| APK asset parity | PASS:四份 Android asset 的 metadata 与 field bytes 均与仓库 fixture 完全相同 |
首次整库构建尝试被 sandbox 默认 ccache 目录只读中断;以 `CCACHE_DIR=/tmp/maplibre-particle-ccache` 重新执行上述受影响对象检查后通过。这不是代码编译失败。
@@ -57,7 +56,7 @@ cd platform/android
- T1-T12 Android 设备验收、截图和 OpenGL shader 实机链接尚未执行。
- 独立 EGL context-loss 设备证据沿用 30-02 的 Accepted Risk;本实现已按 resource generation 重建 CPU field 的 GPU texture。
- iOS、Metal、Android Vulkan、真实数据、生产 coastline/mask、最终粒子数和性能指标均不在本 Stage A 范围。
- fixture 含 NoData cell 的实机路径尚未有单独 fixture;adapter 已校验 NoData contract,当前三份 deterministic field 均无 NoData cell。
- Android T1-T12 和实机 OpenGL shader 链接尚未执行;NoData 已有 deterministic fixture/static smoke 覆盖,但没有实机视觉证据。
## 下一步