mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-10 05:08:31 +09:00
[Fix] (Retrace): load ANGLE through LD_LIBRARY_PATH
This commit is contained in:
@@ -50,7 +50,7 @@ Implementation notes:
|
||||
- `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.
|
||||
- Set `MOBILEGL_RETRACE_USE_ANGLE=1` when running `trace-replay-ci.sh` to pass `use_angle=true` for DirectGLES. Set `MOBILEGL_RETRACE_USE_PBUFFER=1` or pass `--use-pbuffer` to keep DirectGLES offscreen. The APK must include `libEGL_angle.so` and `libGLESv2_angle.so` under its x86_64 native libraries. The Activity passes Android's `nativeLibraryDir` to native code as `MOBILEGL_RETRACE_ANGLE_DIR`.
|
||||
- Set `MOBILEGL_USE_ANGLE=1` when running `trace-replay-ci.sh` to pass `use_angle=true` for DirectGLES. Set `MOBILEGL_RETRACE_USE_PBUFFER=1` or pass `--use-pbuffer` to keep DirectGLES offscreen. The APK must include `libEGL_angle.so` and `libGLESv2_angle.so` under its x86_64 native libraries. The native runner prepends the ANGLE directory to `LD_LIBRARY_PATH` before loading MobileGL.
|
||||
|
||||
Example core-profile trace smoke command for a debug trace APK:
|
||||
|
||||
|
||||
@@ -88,10 +88,24 @@ bool UseAngleForRequest(const Request& request) {
|
||||
if (request.useAngle) {
|
||||
return true;
|
||||
}
|
||||
const char* value = getenv("MOBILEGL_RETRACE_USE_ANGLE");
|
||||
const char* value = getenv("MOBILEGL_USE_ANGLE");
|
||||
return value != nullptr && strcmp(value, "1") == 0;
|
||||
}
|
||||
|
||||
void PrependLibraryPath(const std::string& directory) {
|
||||
if (directory.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const char* current = getenv("LD_LIBRARY_PATH");
|
||||
std::string value = directory;
|
||||
if (current != nullptr && current[0] != '\0') {
|
||||
value += ":";
|
||||
value += current;
|
||||
}
|
||||
setenv("LD_LIBRARY_PATH", value.c_str(), 1);
|
||||
}
|
||||
|
||||
bool EnsureDirectory(const std::string& path) {
|
||||
if (path.empty()) {
|
||||
return false;
|
||||
@@ -141,13 +155,12 @@ bool LoadMobileGL(const Request& request, std::string& error) {
|
||||
unsetenv("MOBILEGL_MAGMA_R11G11B10F_FALLBACK");
|
||||
}
|
||||
if (UseAngleForRequest(request)) {
|
||||
setenv("MOBILEGL_RETRACE_USE_ANGLE", "1", 1);
|
||||
setenv("MOBILEGL_USE_ANGLE", "1", 1);
|
||||
if (!request.angleLibraryDir.empty()) {
|
||||
setenv("MOBILEGL_RETRACE_ANGLE_DIR", request.angleLibraryDir.c_str(), 1);
|
||||
PrependLibraryPath(request.angleLibraryDir);
|
||||
}
|
||||
} else {
|
||||
unsetenv("MOBILEGL_RETRACE_USE_ANGLE");
|
||||
unsetenv("MOBILEGL_RETRACE_ANGLE_DIR");
|
||||
unsetenv("MOBILEGL_USE_ANGLE");
|
||||
}
|
||||
if (request.avoidAngleLlvmpipeSamplerMipmapMinFilter) {
|
||||
setenv("MOBILEGL_AVOID_SAMPLER_MIPMAP_MIN_FILTER", "1", 1);
|
||||
|
||||
@@ -31,7 +31,7 @@ Usage:
|
||||
[--avoid-angle-llvmpipe-sampler-mipmap-min-filter] \
|
||||
--timeout-seconds N
|
||||
|
||||
Set MOBILEGL_RETRACE_USE_ANGLE=1 to run DirectGLES replay with packaged ANGLE
|
||||
Set MOBILEGL_USE_ANGLE=1 to run DirectGLES replay with packaged ANGLE
|
||||
instead of the device system GLES driver.
|
||||
Set MOBILEGL_RETRACE_USE_PBUFFER=1 or pass --use-pbuffer to run DirectGLES
|
||||
against an offscreen EGL pbuffer instead of the Activity surface.
|
||||
@@ -245,7 +245,7 @@ run_retrace() {
|
||||
if [ -n "${alternate_golden_path}" ]; then
|
||||
alternate_golden_app_path="${app_dir}/input/alternate-golden.png"
|
||||
fi
|
||||
if [ "${MOBILEGL_RETRACE_USE_ANGLE:-}" = "1" ] && [ "${backend}" = "DirectGLES" ]; then
|
||||
if [ "${MOBILEGL_USE_ANGLE:-}" = "1" ] && [ "${backend}" = "DirectGLES" ]; then
|
||||
use_angle=1
|
||||
fi
|
||||
if [ "${MOBILEGL_RETRACE_USE_PBUFFER:-}" = "1" ] && [ "${backend}" = "DirectGLES" ]; then
|
||||
|
||||
Reference in New Issue
Block a user