[Fix, Test] (MG_Backend/DirectGLES, MG_Util, CI): keep an explicit LOD constant under a new avoid flag - folding the bias uniform into it kills the ANGLE llvmpipe JIT

This commit is contained in:
2026-08-12 01:42:55 -04:00
parent b5e9339c66
commit 205d837942
16 changed files with 72 additions and 5 deletions
@@ -154,6 +154,11 @@ bool LoadMobileGL(const Request& request, std::string& error) {
} else {
unsetenv("MOBILEGL_AVOID_SAMPLER_MIPMAP_MIN_FILTER");
}
if (request.avoidAngleLlvmpipeExplicitLodBias) {
setenv("MOBILEGL_AVOID_EXPLICIT_LOD_BIAS", "1", 1);
} else {
unsetenv("MOBILEGL_AVOID_EXPLICIT_LOD_BIAS");
}
if (request.coherentAsFlush) {
setenv("MOBILEGL_COHERENT_AS_FLUSH", "1", 1);
} else {
@@ -792,6 +797,8 @@ bool WriteResultJson(const Request& request, const Result& result) {
file << " \"usePbuffer\": " << (request.usePbuffer ? "true" : "false") << ",\n";
file << " \"avoidAngleLlvmpipeSamplerMipmapMinFilter\": "
<< (request.avoidAngleLlvmpipeSamplerMipmapMinFilter ? "true" : "false") << ",\n";
file << " \"avoidAngleLlvmpipeExplicitLodBias\": "
<< (request.avoidAngleLlvmpipeExplicitLodBias ? "true" : "false") << ",\n";
file << " \"holdMs\": " << request.holdMs << ",\n";
file << " \"mismatchPixels\": " << result.mismatchPixels << "\n";
file << "}\n";
@@ -39,6 +39,7 @@ struct Request {
bool useAngle = false;
bool usePbuffer = true;
bool avoidAngleLlvmpipeSamplerMipmapMinFilter = false;
bool avoidAngleLlvmpipeExplicitLodBias = false;
bool coherentAsFlush = false;
int holdMs = 0;
};
@@ -102,6 +102,7 @@ Java_top_mobilegl_plugin_trace_TraceReplayActivity_nativeRunTraceReplay(JNIEnv*
jboolean useAngle,
jboolean usePbuffer,
jboolean avoidAngleLlvmpipeSamplerMipmapMinFilter,
jboolean avoidAngleLlvmpipeExplicitLodBias,
jboolean coherentAsFlush) {
mobilegl_trace::Request request;
request.tracePath = ToString(env, tracePath);
@@ -127,6 +128,7 @@ Java_top_mobilegl_plugin_trace_TraceReplayActivity_nativeRunTraceReplay(JNIEnv*
request.usePbuffer = usePbuffer == JNI_TRUE;
request.avoidAngleLlvmpipeSamplerMipmapMinFilter =
avoidAngleLlvmpipeSamplerMipmapMinFilter == JNI_TRUE;
request.avoidAngleLlvmpipeExplicitLodBias = avoidAngleLlvmpipeExplicitLodBias == JNI_TRUE;
request.coherentAsFlush = coherentAsFlush == JNI_TRUE;
ScopedTraceReplayState replayState;
@@ -114,6 +114,7 @@ public final class TraceReplayActivity extends Activity {
request.useAngle,
request.usePbuffer,
request.avoidAngleLlvmpipeSamplerMipmapMinFilter,
request.avoidAngleLlvmpipeExplicitLodBias,
request.coherentAsFlush
);
Log.i(TAG, result.toString());
@@ -145,6 +146,7 @@ public final class TraceReplayActivity extends Activity {
boolean useAngle,
boolean usePbuffer,
boolean avoidAngleLlvmpipeSamplerMipmapMinFilter,
boolean avoidAngleLlvmpipeExplicitLodBias,
boolean coherentAsFlush
);
@@ -168,6 +170,7 @@ public final class TraceReplayActivity extends Activity {
final boolean useAngle;
final boolean usePbuffer;
final boolean avoidAngleLlvmpipeSamplerMipmapMinFilter;
final boolean avoidAngleLlvmpipeExplicitLodBias;
final boolean coherentAsFlush;
private TraceReplayRequest(
@@ -190,6 +193,7 @@ public final class TraceReplayActivity extends Activity {
boolean useAngle,
boolean usePbuffer,
boolean avoidAngleLlvmpipeSamplerMipmapMinFilter,
boolean avoidAngleLlvmpipeExplicitLodBias,
boolean coherentAsFlush
) {
this.tracePath = tracePath;
@@ -211,6 +215,7 @@ public final class TraceReplayActivity extends Activity {
this.useAngle = useAngle;
this.usePbuffer = usePbuffer;
this.avoidAngleLlvmpipeSamplerMipmapMinFilter = avoidAngleLlvmpipeSamplerMipmapMinFilter;
this.avoidAngleLlvmpipeExplicitLodBias = avoidAngleLlvmpipeExplicitLodBias;
this.coherentAsFlush = coherentAsFlush;
}
@@ -237,6 +242,7 @@ public final class TraceReplayActivity extends Activity {
intent.getBooleanExtra("use_angle", false),
intent.getBooleanExtra("use_pbuffer", false),
intent.getBooleanExtra("avoid_angle_llvmpipe_sampler_mipmap_min_filter", false),
intent.getBooleanExtra("avoid_angle_llvmpipe_explicit_lod_bias", false),
intent.getBooleanExtra("coherent_as_flush", false)
);
}
+12
View File
@@ -29,6 +29,7 @@ Usage:
--crop-height N \
[--use-pbuffer] \
[--avoid-angle-llvmpipe-sampler-mipmap-min-filter] \
[--avoid-angle-llvmpipe-explicit-lod-bias] \
[--coherent-as-flush] \
--timeout-seconds N
@@ -40,6 +41,9 @@ Set MOBILEGL_RETRACE_USE_PBUFFER=1 or pass --use-pbuffer to run DirectGLES
against an offscreen EGL pbuffer instead of the Activity surface.
Pass --avoid-angle-llvmpipe-sampler-mipmap-min-filter for DirectGLES traces that
need ANGLE llvmpipe sampler mipmap filters downgraded to avoid driver stalls.
Pass --avoid-angle-llvmpipe-explicit-lod-bias for DirectGLES traces whose shaders
sample with an explicit LOD that ANGLE llvmpipe cannot take a LOD bias on
(MOBILEGL_AVOID_EXPLICIT_LOD_BIAS=1).
Pass --coherent-as-flush for traces whose engine writes persistent
GL_MAP_FLUSH_EXPLICIT_BIT maps it never flushes (MOBILEGL_COHERENT_AS_FLUSH=1).
EOF
@@ -98,6 +102,7 @@ crop_width=""
crop_height=""
use_pbuffer=0
avoid_angle_llvmpipe_sampler_mipmap_min_filter=0
avoid_angle_llvmpipe_explicit_lod_bias=0
coherent_as_flush=0
timeout_seconds=""
@@ -134,6 +139,10 @@ while [ "$#" -gt 0 ]; do
avoid_angle_llvmpipe_sampler_mipmap_min_filter=1
shift 1
;;
--avoid-angle-llvmpipe-explicit-lod-bias)
avoid_angle_llvmpipe_explicit_lod_bias=1
shift 1
;;
--coherent-as-flush) coherent_as_flush=1; shift 1 ;;
--timeout-seconds) timeout_seconds="$(next_arg "$@")"; shift 2 ;;
-h|--help) usage; exit 0 ;;
@@ -320,6 +329,9 @@ run_retrace() {
if [ "${avoid_angle_llvmpipe_sampler_mipmap_min_filter}" -eq 1 ] && [ "${backend}" = "DirectGLES" ]; then
set -- "$@" --ez avoid_angle_llvmpipe_sampler_mipmap_min_filter true
fi
if [ "${avoid_angle_llvmpipe_explicit_lod_bias}" -eq 1 ] && [ "${backend}" = "DirectGLES" ]; then
set -- "$@" --ez avoid_angle_llvmpipe_explicit_lod_bias true
fi
if [ "${coherent_as_flush}" -eq 1 ]; then
set -- "$@" --ez coherent_as_flush true
fi