mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-30 05:02:15 +09:00
[Feat] (Android plugin, renderer samples): add interactive tests and external trace replay
This commit is contained in:
1 parent
9560cca571
commit
04f7faedc1
17 files changed
+2328
-30
No files matched your search
@@ -1,19 +1,26 @@
|
||||
# MobileGL trace replay APK
|
||||
# MobileGL trace replay on Android
|
||||
|
||||
The Android plugin app has two flavor dimensions:
|
||||
## Replay from the Test page
|
||||
|
||||
- `backend`: `espryt` uses `DirectGLES`, `magma` uses `DirectVulkan`.
|
||||
- `profile`: `plugin` keeps the original FCL plugin APK behavior, `trace` adds the standalone trace runner Activity.
|
||||
In the Android app, open **Test**, set any **Environment** overrides, and tap **Replay trace…**.
|
||||
Choose an apitrace file from Android’s file picker. Replay starts after the app copies the document
|
||||
into its private cache. The Test page shows the snapshot from the last frame boundary, or from
|
||||
the last call if the trace has no frame boundary. Tap **Cancel trace replay** to stop importing or
|
||||
replaying. The app keeps the latest trace result and snapshot in its cache.
|
||||
|
||||
Useful debug builds:
|
||||
Both the standard plugin and the trace APK include the replay library. Supply your own trace file.
|
||||
|
||||
## Run with adb
|
||||
|
||||
The `trace` profile exposes a standalone runner for adb and CI. It uses the `.trace` application
|
||||
ID suffix. From the repository root, build either debug variant with the installed Gradle:
|
||||
|
||||
```sh
|
||||
./gradlew -p MobileGL/android-plugin :app:assembleEsprytPluginDebug
|
||||
./gradlew -p MobileGL/android-plugin :app:assembleEsprytTraceDebug
|
||||
./gradlew -p MobileGL/android-plugin :app:assembleMagmaTraceDebug
|
||||
gradle -p android-plugin :app:assemblePluginDebug
|
||||
gradle -p android-plugin :app:assembleTraceDebug
|
||||
```
|
||||
|
||||
The trace profile keeps the existing plugin manifest metadata and adds:
|
||||
The trace profile exposes the following activity:
|
||||
|
||||
```text
|
||||
action: top.mobilegl.plugin.TRACE_REPLAY
|
||||
@@ -27,7 +34,7 @@ trace_path absolute path to the apitrace file
|
||||
golden_path optional absolute path to a golden PNG
|
||||
output_dir directory for result.json and actual.png
|
||||
diff_path optional absolute path for a golden-difference PNG
|
||||
backend DirectGLES or DirectVulkan; defaults to the backend flavor
|
||||
backend DirectGLES (the default) or DirectVulkan
|
||||
target_frame target frame index, or -1
|
||||
target_call target call number, or -1
|
||||
width optional replay surface width override
|
||||
@@ -50,7 +57,7 @@ Implementation notes:
|
||||
- The runner uses a MobileGL-backed EGL window-system shim. GLX calls in PC traces are consumed by apitrace's GLX retrace frontend and mapped onto this EGL shim; the Android runner does not require or call a MobileGL GLX implementation.
|
||||
- `DirectGLES` and `DirectVulkan` replay on the Activity `SurfaceView` by default. DirectGLES can still use the old offscreen EGL pbuffer path by passing `use_pbuffer=true`.
|
||||
- Golden comparison is implemented in native C++ with libpng RGBA decode and SSIM validation. The Java Activity only passes arguments and displays the native result, so the replay/compare core is not tied to Android UI or Bitmap APIs and can be ported to Linux.
|
||||
- The plugin profile still excludes `libtrace_replay_runner.so`; normal plugin APK behavior is preserved.
|
||||
- The standard plugin exposes replay through its private Test service.
|
||||
- Set `MOBILEGL_ESPRYT_USE_ANGLE=1` and `MOBILEGL_TRACE_ANGLE_VARIANT=<short-hash>` when running `trace-replay-ci.sh` for DirectGLES. The trace APK contains both allowlisted ANGLE builds with short-hash filenames and SONAMEs; MobileGL resolves its signed native library directory and loads the selected pair by absolute path. Set `MOBILEGL_RETRACE_USE_PBUFFER=1` or pass `--use-pbuffer` to keep DirectGLES offscreen.
|
||||
|
||||
Example core-profile trace smoke command for a debug trace APK:
|
||||
@@ -58,21 +65,21 @@ Example core-profile trace smoke command for a debug trace APK:
|
||||
```sh
|
||||
adb push app.trace /data/local/tmp/mobilegl_app.trace
|
||||
adb push app.golden.png /data/local/tmp/mobilegl_app_ref.png
|
||||
adb shell run-as top.mobilegl.plugin.espryt.trace mkdir -p files/trace-replay/input files/trace-replay/output
|
||||
adb shell run-as top.mobilegl.plugin.espryt.trace cp /data/local/tmp/mobilegl_app.trace files/trace-replay/input/app.trace
|
||||
adb shell run-as top.mobilegl.plugin.espryt.trace cp /data/local/tmp/mobilegl_app_ref.png files/trace-replay/input/app.golden.png
|
||||
adb shell run-as top.mobilegl.plugin.trace mkdir -p files/trace-replay/input files/trace-replay/output
|
||||
adb shell run-as top.mobilegl.plugin.trace cp /data/local/tmp/mobilegl_app.trace files/trace-replay/input/app.trace
|
||||
adb shell run-as top.mobilegl.plugin.trace cp /data/local/tmp/mobilegl_app_ref.png files/trace-replay/input/app.golden.png
|
||||
adb shell am start -a top.mobilegl.plugin.TRACE_REPLAY \
|
||||
-n top.mobilegl.plugin.espryt.trace/top.mobilegl.plugin.trace.TraceReplayActivity \
|
||||
--es trace_path /data/user/0/top.mobilegl.plugin.espryt.trace/files/trace-replay/input/app.trace \
|
||||
--es golden_path /data/user/0/top.mobilegl.plugin.espryt.trace/files/trace-replay/input/app.golden.png \
|
||||
--es output_dir /data/user/0/top.mobilegl.plugin.espryt.trace/files/trace-replay/output \
|
||||
--es diff_path /data/user/0/top.mobilegl.plugin.espryt.trace/files/trace-replay/output/app-diff.png \
|
||||
-n top.mobilegl.plugin.trace/top.mobilegl.plugin.trace.TraceReplayActivity \
|
||||
--es trace_path /data/user/0/top.mobilegl.plugin.trace/files/trace-replay/input/app.trace \
|
||||
--es golden_path /data/user/0/top.mobilegl.plugin.trace/files/trace-replay/input/app.golden.png \
|
||||
--es output_dir /data/user/0/top.mobilegl.plugin.trace/files/trace-replay/output \
|
||||
--es diff_path /data/user/0/top.mobilegl.plugin.trace/files/trace-replay/output/app-diff.png \
|
||||
--es backend DirectGLES \
|
||||
--ez use_angle true \
|
||||
--es angle_variant ec889e6ea831 \
|
||||
--el target_call 31249 \
|
||||
--es ssim_threshold 0.99
|
||||
adb shell run-as top.mobilegl.plugin.espryt.trace cat files/trace-replay/output/result.json
|
||||
adb shell run-as top.mobilegl.plugin.trace cat files/trace-replay/output/result.json
|
||||
```
|
||||
|
||||
## Emulator shards in CI
|
||||
|
||||
Reference in new issue
Block a user