Android: track disjoint mip layouts and add Vulkan validation tools

This commit is contained in:
shen
2026-10-15 18:53:45 -07:00
parent 8eb294e7e0
commit a6c3655e21
12 changed files with 546 additions and 47 deletions
+58
View File
@@ -0,0 +1,58 @@
# Android subresource-layout validation
Local validation date: 2026-10-15 (America/Los_Angeles).
This change retains `android-port` and its build94012 game integration. The
per-mip approach is adapted from [dodola/d2r-mobile at 642480b](https://github.com/dodola/d2r-mobile/blob/642480b7606cf4adda30bcf009eb56f87745c908/dm/gfx/nvn/nvn_vk.c).
No build91738 game addresses or platform/input services were imported.
## Implemented scope
- Track independent layouts for single-layer 2D color mip chains (2–16 levels)
when sampled mips do not intersect any attachment mip in either graphics stage.
- Retain the existing path for storage/comparison images, overlapping views,
depth/stencil, arrays, volumes and devices using feedback-layout support.
- Consolidate mixed layouts using the actual old layout of each mip run before
whole-image operations; restore individual layouts after diagnostic captures.
- Allow device A/B with `DM_VK_SUBRES=0` / `1`, without replacing the current
pipeline cache, input, audio, save or APK packaging implementations.
- Add a game-free system Vulkan capability probe, GPU readback fixture and a
host/NDK/device test runner with explicit device opt-in and JSON receipts.
## Completed checks
| Check | Result |
| --- | --- |
| Production layout tracker vs independent per-level oracle | 320,000 deterministic random transitions; 407,319 emitted barriers checked |
| Same regression with AddressSanitizer + UndefinedBehaviorSanitizer | Passed |
| Invalid ranges, no-op transitions, mixed-to-uniform transitions, >16-level whole-image fallback | Passed in both host builds |
| NDK 28.2.13676358 / API 33 / arm64 device test binaries | `t_vk_perf` and `t_vk_caps` built and linked |
| Production Vulkan App object, `-fPIC -ffixed-x18 -O2` | Built successfully |
| Diff whitespace and Python syntax | Passed |
Reproduction:
```sh
python3 dm/android/tests/run_checks.py --output dm/android/build/checks-new
```
Local receipts and compiler logs are under ignored
`dm/android/build/checks-mip-final/`. The JSON explicitly records
`device_contacted: false`, `gpu_executed: false` and `game_tested: false`.
## Outstanding device and package checks
No Android device was attached. The new cross-stage binding-policy and real
Vulkan mip pixel-readback fixtures were compiled, **not executed**. No Mali game
compatibility, validation-layer cleanliness, improved FPS, display cadence,
thermal behavior or power result is claimed.
The full App native-library build was attempted but stopped at the missing
generated `dm_hud_exp.h` included by `dm/host/diag.c`. Generate the host headers
from the player's own resources before validating the complete library/APK.
The modified production Vulkan object builds independently of that header.
Use the explicit `--run-device --serial DEVICE_SERIAL` runner option for GPU
checks, then perform the controlled game A/B described in the Android README.
The capability probe reports the system driver; an app using a private Turnip
driver requires separate testing with that driver.