mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-08 04:08:32 +09:00
[Refactor] (MG_Impl/GLImpl): replace Flywheel dispatch sync hack with MOBILEGL_COHERENT_AS_FLUSH
This commit is contained in:
@@ -86,6 +86,7 @@ val pluginRendererConfig = buildJsonValue {
|
||||
toggleable("MOBILEGL_MAGMA_R11G11B10F_FALLBACK", "1", false, RendererConfig.MetaString("mobilegl_magma_r11g11b10f_fallback_title"))
|
||||
customizable("MOBILEGL_MAGMA_FRAMESINFLIGHT", "3", RendererConfig.MetaString("mobilegl_magma_frames_inflight_title"))
|
||||
toggleable("MOBILEGL_AVOID_SAMPLER_MIPMAP_MIN_FILTER", "1", false, RendererConfig.MetaString("mobilegl_avoid_sampler_mipmap_min_filter_title"))
|
||||
toggleable("MOBILEGL_COHERENT_AS_FLUSH", "1", false, RendererConfig.MetaString("mobilegl_coherent_as_flush_title"))
|
||||
toggleable("MOBILEGL_USE_ANGLE", "1", false, RendererConfig.MetaString("mobilegl_use_angle_title"))
|
||||
},
|
||||
minMCVer = null,
|
||||
|
||||
@@ -43,6 +43,9 @@
|
||||
<meta-data
|
||||
android:name="mobilegl_avoid_sampler_mipmap_min_filter_title"
|
||||
android:resource="@string/mobilegl_avoid_sampler_mipmap_min_filter_title" />
|
||||
<meta-data
|
||||
android:name="mobilegl_coherent_as_flush_title"
|
||||
android:resource="@string/mobilegl_coherent_as_flush_title" />
|
||||
<meta-data
|
||||
android:name="mobilegl_use_angle_title"
|
||||
android:resource="@string/mobilegl_use_angle_title" />
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<string name="mobilegl_magma_r11g11b10f_fallback_title">Use Magma R11G11B10F fallback</string>
|
||||
<string name="mobilegl_magma_frames_inflight_title">Magma frames in flight (1-64)</string>
|
||||
<string name="mobilegl_avoid_sampler_mipmap_min_filter_title">Avoid sampler mipmap minification filters</string>
|
||||
<string name="mobilegl_coherent_as_flush_title">Treat explicit-flush persistent maps as coherent</string>
|
||||
<string name="mobilegl_use_angle_title">Use ANGLE GLES libraries</string>
|
||||
<string name="mobilegl_default_backend" translatable="false">DirectGLES</string>
|
||||
</resources>
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
<meta-data
|
||||
android:name="mobilegl_avoid_sampler_mipmap_min_filter_title"
|
||||
tools:node="remove" />
|
||||
<meta-data
|
||||
android:name="mobilegl_coherent_as_flush_title"
|
||||
tools:node="remove" />
|
||||
<meta-data
|
||||
android:name="mobilegl_use_angle_title"
|
||||
tools:node="remove" />
|
||||
|
||||
@@ -149,6 +149,11 @@ bool LoadMobileGL(const Request& request, std::string& error) {
|
||||
} else {
|
||||
unsetenv("MOBILEGL_AVOID_SAMPLER_MIPMAP_MIN_FILTER");
|
||||
}
|
||||
if (request.coherentAsFlush) {
|
||||
setenv("MOBILEGL_COHERENT_AS_FLUSH", "1", 1);
|
||||
} else {
|
||||
unsetenv("MOBILEGL_COHERENT_AS_FLUSH");
|
||||
}
|
||||
|
||||
void* handle = dlopen(request.mobileGlLibrary.c_str(), RTLD_NOW | RTLD_GLOBAL);
|
||||
if (handle == nullptr) {
|
||||
|
||||
@@ -36,6 +36,7 @@ struct Request {
|
||||
bool useAngle = false;
|
||||
bool usePbuffer = true;
|
||||
bool avoidAngleLlvmpipeSamplerMipmapMinFilter = false;
|
||||
bool coherentAsFlush = false;
|
||||
int holdMs = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -101,7 +101,8 @@ Java_top_mobilegl_plugin_trace_TraceReplayActivity_nativeRunTraceReplay(JNIEnv*
|
||||
jstring angleVariant,
|
||||
jboolean useAngle,
|
||||
jboolean usePbuffer,
|
||||
jboolean avoidAngleLlvmpipeSamplerMipmapMinFilter) {
|
||||
jboolean avoidAngleLlvmpipeSamplerMipmapMinFilter,
|
||||
jboolean coherentAsFlush) {
|
||||
mobilegl_trace::Request request;
|
||||
request.tracePath = ToString(env, tracePath);
|
||||
request.goldenPath = ToString(env, goldenPath);
|
||||
@@ -126,6 +127,7 @@ Java_top_mobilegl_plugin_trace_TraceReplayActivity_nativeRunTraceReplay(JNIEnv*
|
||||
request.usePbuffer = usePbuffer == JNI_TRUE;
|
||||
request.avoidAngleLlvmpipeSamplerMipmapMinFilter =
|
||||
avoidAngleLlvmpipeSamplerMipmapMinFilter == JNI_TRUE;
|
||||
request.coherentAsFlush = coherentAsFlush == JNI_TRUE;
|
||||
|
||||
ScopedTraceReplayState replayState;
|
||||
mobilegl_trace_set_requested_size(request.width, request.height);
|
||||
|
||||
+10
-4
@@ -113,7 +113,8 @@ public final class TraceReplayActivity extends Activity {
|
||||
request.angleVariant,
|
||||
request.useAngle,
|
||||
request.usePbuffer,
|
||||
request.avoidAngleLlvmpipeSamplerMipmapMinFilter
|
||||
request.avoidAngleLlvmpipeSamplerMipmapMinFilter,
|
||||
request.coherentAsFlush
|
||||
);
|
||||
Log.i(TAG, result.toString());
|
||||
TraceReplayResult finalResult = result;
|
||||
@@ -143,7 +144,8 @@ public final class TraceReplayActivity extends Activity {
|
||||
String angleVariant,
|
||||
boolean useAngle,
|
||||
boolean usePbuffer,
|
||||
boolean avoidAngleLlvmpipeSamplerMipmapMinFilter
|
||||
boolean avoidAngleLlvmpipeSamplerMipmapMinFilter,
|
||||
boolean coherentAsFlush
|
||||
);
|
||||
|
||||
private static final class TraceReplayRequest {
|
||||
@@ -166,6 +168,7 @@ public final class TraceReplayActivity extends Activity {
|
||||
final boolean useAngle;
|
||||
final boolean usePbuffer;
|
||||
final boolean avoidAngleLlvmpipeSamplerMipmapMinFilter;
|
||||
final boolean coherentAsFlush;
|
||||
|
||||
private TraceReplayRequest(
|
||||
String tracePath,
|
||||
@@ -186,7 +189,8 @@ public final class TraceReplayActivity extends Activity {
|
||||
String angleVariant,
|
||||
boolean useAngle,
|
||||
boolean usePbuffer,
|
||||
boolean avoidAngleLlvmpipeSamplerMipmapMinFilter
|
||||
boolean avoidAngleLlvmpipeSamplerMipmapMinFilter,
|
||||
boolean coherentAsFlush
|
||||
) {
|
||||
this.tracePath = tracePath;
|
||||
this.goldenPath = goldenPath;
|
||||
@@ -207,6 +211,7 @@ public final class TraceReplayActivity extends Activity {
|
||||
this.useAngle = useAngle;
|
||||
this.usePbuffer = usePbuffer;
|
||||
this.avoidAngleLlvmpipeSamplerMipmapMinFilter = avoidAngleLlvmpipeSamplerMipmapMinFilter;
|
||||
this.coherentAsFlush = coherentAsFlush;
|
||||
}
|
||||
|
||||
static TraceReplayRequest from(Intent intent, File filesDir, String defaultBackend) {
|
||||
@@ -231,7 +236,8 @@ public final class TraceReplayActivity extends Activity {
|
||||
readString(intent, "angle_variant", ""),
|
||||
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_sampler_mipmap_min_filter", false),
|
||||
intent.getBooleanExtra("coherent_as_flush", false)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ Usage:
|
||||
--crop-height N \
|
||||
[--use-pbuffer] \
|
||||
[--avoid-angle-llvmpipe-sampler-mipmap-min-filter] \
|
||||
[--coherent-as-flush] \
|
||||
--timeout-seconds N
|
||||
|
||||
Set MOBILEGL_USE_ANGLE=1 to run DirectGLES replay with packaged ANGLE
|
||||
@@ -38,6 +39,8 @@ 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 --coherent-as-flush for traces whose engine writes persistent
|
||||
GL_MAP_FLUSH_EXPLICIT_BIT maps it never flushes (MOBILEGL_COHERENT_AS_FLUSH=1).
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -94,6 +97,7 @@ crop_width=""
|
||||
crop_height=""
|
||||
use_pbuffer=0
|
||||
avoid_angle_llvmpipe_sampler_mipmap_min_filter=0
|
||||
coherent_as_flush=0
|
||||
timeout_seconds=""
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
@@ -129,6 +133,7 @@ while [ "$#" -gt 0 ]; do
|
||||
avoid_angle_llvmpipe_sampler_mipmap_min_filter=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 ;;
|
||||
*) die "unknown argument: $1" ;;
|
||||
@@ -254,6 +259,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 [ "${coherent_as_flush}" -eq 1 ]; then
|
||||
set -- "$@" --ez coherent_as_flush true
|
||||
fi
|
||||
set -- "$@" \
|
||||
--es output_dir "${app_dir}/output" \
|
||||
--es diff_path "${app_dir}/output/${safe_case}-diff.png" \
|
||||
|
||||
Reference in New Issue
Block a user