[Fix] (Retrace): bundle and select signed ANGLE variants

This commit is contained in:
2026-07-15 06:48:10 +08:00
parent 9c0d5517bd
commit b6d311f20b
13 changed files with 240 additions and 79 deletions
@@ -89,20 +89,6 @@ bool UseAngleForRequest(const Request& request) {
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;
@@ -153,11 +139,10 @@ bool LoadMobileGL(const Request& request, std::string& error) {
}
if (UseAngleForRequest(request)) {
setenv("MOBILEGL_USE_ANGLE", "1", 1);
if (!request.angleLibraryDir.empty()) {
PrependLibraryPath(request.angleLibraryDir);
}
setenv("MOBILEGL_TRACE_ANGLE_VARIANT", request.angleVariant.c_str(), 1);
} else {
unsetenv("MOBILEGL_USE_ANGLE");
unsetenv("MOBILEGL_TRACE_ANGLE_VARIANT");
}
if (request.avoidAngleLlvmpipeSamplerMipmapMinFilter) {
setenv("MOBILEGL_AVOID_SAMPLER_MIPMAP_MIN_FILTER", "1", 1);
@@ -755,7 +740,7 @@ bool WriteResultJson(const Request& request, const Result& result) {
file << " \"actualPath\": \"" << JsonEscape(result.actualPath) << "\",\n";
file << " \"diffPath\": \"" << JsonEscape(result.diffPath) << "\",\n";
file << " \"backend\": \"" << JsonEscape(request.backend) << "\",\n";
file << " \"angleLibraryDir\": \"" << JsonEscape(request.angleLibraryDir) << "\",\n";
file << " \"angleVariant\": \"" << JsonEscape(request.angleVariant) << "\",\n";
file << " \"targetFrame\": " << request.targetFrame << ",\n";
file << " \"targetCall\": " << request.targetCall << ",\n";
file << " \"width\": " << request.width << ",\n";
@@ -23,7 +23,7 @@ struct Request {
std::string diffPath;
std::string backend;
std::string mobileGlLibrary = "libMobileGL.so";
std::string angleLibraryDir;
std::string angleVariant;
int targetFrame = -1;
long long targetCall = -1;
int width = 0;
@@ -98,7 +98,7 @@ Java_top_mobilegl_plugin_trace_TraceReplayActivity_nativeRunTraceReplay(JNIEnv*
jint cropY,
jint cropWidth,
jint cropHeight,
jstring angleLibraryDir,
jstring angleVariant,
jboolean useAngle,
jboolean usePbuffer,
jboolean avoidAngleLlvmpipeSamplerMipmapMinFilter) {
@@ -112,7 +112,7 @@ Java_top_mobilegl_plugin_trace_TraceReplayActivity_nativeRunTraceReplay(JNIEnv*
request.outputDir = ToString(env, outputDir);
request.diffPath = ToString(env, diffPath);
request.backend = ToString(env, backend);
request.angleLibraryDir = ToString(env, angleLibraryDir);
request.angleVariant = ToString(env, angleVariant);
request.targetFrame = targetFrame;
request.targetCall = targetCall;
request.width = width;
@@ -44,7 +44,6 @@ public final class TraceReplayActivity extends Activity {
request = TraceReplayRequest.from(
intent,
getFilesDir(),
getApplicationInfo().nativeLibraryDir,
getString(top.mobilegl.plugin.R.string.mobilegl_default_backend)
);
statusView = new TextView(this);
@@ -111,7 +110,7 @@ public final class TraceReplayActivity extends Activity {
request.cropY,
request.cropWidth,
request.cropHeight,
request.angleLibraryDir,
request.angleVariant,
request.useAngle,
request.usePbuffer,
request.avoidAngleLlvmpipeSamplerMipmapMinFilter
@@ -141,7 +140,7 @@ public final class TraceReplayActivity extends Activity {
int cropY,
int cropWidth,
int cropHeight,
String angleLibraryDir,
String angleVariant,
boolean useAngle,
boolean usePbuffer,
boolean avoidAngleLlvmpipeSamplerMipmapMinFilter
@@ -163,7 +162,7 @@ public final class TraceReplayActivity extends Activity {
final int cropY;
final int cropWidth;
final int cropHeight;
final String angleLibraryDir;
final String angleVariant;
final boolean useAngle;
final boolean usePbuffer;
final boolean avoidAngleLlvmpipeSamplerMipmapMinFilter;
@@ -184,7 +183,7 @@ public final class TraceReplayActivity extends Activity {
int cropY,
int cropWidth,
int cropHeight,
String angleLibraryDir,
String angleVariant,
boolean useAngle,
boolean usePbuffer,
boolean avoidAngleLlvmpipeSamplerMipmapMinFilter
@@ -204,13 +203,13 @@ public final class TraceReplayActivity extends Activity {
this.cropY = cropY;
this.cropWidth = cropWidth;
this.cropHeight = cropHeight;
this.angleLibraryDir = angleLibraryDir;
this.angleVariant = angleVariant;
this.useAngle = useAngle;
this.usePbuffer = usePbuffer;
this.avoidAngleLlvmpipeSamplerMipmapMinFilter = avoidAngleLlvmpipeSamplerMipmapMinFilter;
}
static TraceReplayRequest from(Intent intent, File filesDir, String nativeLibraryDir, String defaultBackend) {
static TraceReplayRequest from(Intent intent, File filesDir, String defaultBackend) {
String outputDir = readString(intent, "output_dir", new File(filesDir, "trace-replay").getAbsolutePath());
String diffPath = readString(intent, "diff_path", "");
return new TraceReplayRequest(
@@ -229,7 +228,7 @@ public final class TraceReplayActivity extends Activity {
intent.getIntExtra("crop_y", 0),
intent.getIntExtra("crop_width", 0),
intent.getIntExtra("crop_height", 0),
readString(intent, "angle_library_dir", nativeLibraryDir),
readString(intent, "angle_variant", ""),
intent.getBooleanExtra("use_angle", false),
intent.getBooleanExtra("use_pbuffer", false),
intent.getBooleanExtra("avoid_angle_llvmpipe_sampler_mipmap_min_filter", false)