mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Fix] (trace-replay): use SSIM for golden validation
This commit is contained in:
@@ -273,12 +273,11 @@ function(add_trace_replay_test CASE_NAME BACKEND)
|
||||
TARGET_CALL
|
||||
WIDTH
|
||||
HEIGHT
|
||||
TOLERANCE
|
||||
SSIM_THRESHOLD
|
||||
CROP_X
|
||||
CROP_Y
|
||||
CROP_WIDTH
|
||||
CROP_HEIGHT
|
||||
FUZZ_PERCENT)
|
||||
CROP_HEIGHT)
|
||||
cmake_parse_arguments(TRACE_CASE "" "${oneValueArgs}" "" ${ARGN})
|
||||
foreach(required TRACE_ARCHIVE GOLDEN TARGET_CALL WIDTH HEIGHT)
|
||||
if(NOT TRACE_CASE_${required})
|
||||
@@ -288,8 +287,8 @@ function(add_trace_replay_test CASE_NAME BACKEND)
|
||||
if(NOT TRACE_CASE_TRACE_FILE)
|
||||
set(TRACE_CASE_TRACE_FILE trace.trace)
|
||||
endif()
|
||||
if(NOT TRACE_CASE_TOLERANCE)
|
||||
set(TRACE_CASE_TOLERANCE 0)
|
||||
if(NOT TRACE_CASE_SSIM_THRESHOLD)
|
||||
set(TRACE_CASE_SSIM_THRESHOLD 0.99)
|
||||
endif()
|
||||
if(NOT TRACE_CASE_CROP_X)
|
||||
set(TRACE_CASE_CROP_X 0)
|
||||
@@ -303,9 +302,6 @@ function(add_trace_replay_test CASE_NAME BACKEND)
|
||||
if(NOT TRACE_CASE_CROP_HEIGHT)
|
||||
set(TRACE_CASE_CROP_HEIGHT 0)
|
||||
endif()
|
||||
if(NOT TRACE_CASE_FUZZ_PERCENT)
|
||||
set(TRACE_CASE_FUZZ_PERCENT 20)
|
||||
endif()
|
||||
add_test(
|
||||
NAME MobileGLTraceReplay.${CASE_NAME}.${BACKEND}
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
@@ -320,12 +316,11 @@ function(add_trace_replay_test CASE_NAME BACKEND)
|
||||
-DTRACE_TARGET_CALL=${TRACE_CASE_TARGET_CALL}
|
||||
-DTRACE_WIDTH=${TRACE_CASE_WIDTH}
|
||||
-DTRACE_HEIGHT=${TRACE_CASE_HEIGHT}
|
||||
-DTRACE_TOLERANCE=${TRACE_CASE_TOLERANCE}
|
||||
-DTRACE_SSIM_THRESHOLD=${TRACE_CASE_SSIM_THRESHOLD}
|
||||
-DTRACE_CROP_X=${TRACE_CASE_CROP_X}
|
||||
-DTRACE_CROP_Y=${TRACE_CASE_CROP_Y}
|
||||
-DTRACE_CROP_WIDTH=${TRACE_CASE_CROP_WIDTH}
|
||||
-DTRACE_CROP_HEIGHT=${TRACE_CASE_CROP_HEIGHT}
|
||||
-DTRACE_FUZZ_PERCENT=${TRACE_CASE_FUZZ_PERCENT}
|
||||
-DTRACE_OUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR}/${CASE_NAME}/${BACKEND}
|
||||
-DTRACE_ARTIFACT_DIR=${CMAKE_CURRENT_BINARY_DIR}/${CASE_NAME}/actual-images
|
||||
-P ${MOBILEGL_TRACE_ROOT}/run_trace_case.cmake)
|
||||
@@ -350,12 +345,11 @@ add_trace_replay_test_for_backends(OpenRA
|
||||
TARGET_CALL 31249
|
||||
WIDTH 640
|
||||
HEIGHT 480
|
||||
TOLERANCE 3072
|
||||
CROP_X 1
|
||||
CROP_Y 1
|
||||
CROP_WIDTH 638
|
||||
CROP_HEIGHT 478
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-startup
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-startup.tgz
|
||||
@@ -364,8 +358,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-startup
|
||||
TARGET_CALL 92195
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-main-menu
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-main-menu.tgz
|
||||
@@ -374,8 +367,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-main-menu
|
||||
TARGET_CALL 481787
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-in-world.tgz
|
||||
@@ -384,8 +376,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-in-world
|
||||
TARGET_CALL 280000
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-sodium-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-fabric-sodium-in-world.tgz
|
||||
@@ -394,8 +385,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-sodium-in-world
|
||||
TARGET_CALL 923340
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-bsl-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-fabric-iris-bsl-in-world.tgz
|
||||
@@ -404,8 +394,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-bsl-in-world
|
||||
TARGET_CALL 110725
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-makeup-ultrafast-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-fabric-iris-makeup-ultrafast-in-world.tgz
|
||||
@@ -414,8 +403,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-makeup-ultrafast
|
||||
TARGET_CALL 95322
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-super-duper-vanilla-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-fabric-iris-super-duper-vanilla-in-world.tgz
|
||||
@@ -424,8 +412,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-super-duper-vani
|
||||
TARGET_CALL 141559
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-sundial-lite-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-fabric-iris-sundial-lite-in-world.tgz
|
||||
@@ -434,8 +421,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-sundial-lite-in-
|
||||
TARGET_CALL 150023
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-complementary-reimagined-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-fabric-iris-complementary-reimagined-in-world.tgz
|
||||
@@ -444,8 +430,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-complementary-re
|
||||
TARGET_CALL 151297
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-complementary-unbound-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-fabric-iris-complementary-unbound-in-world.tgz
|
||||
@@ -454,8 +439,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-complementary-un
|
||||
TARGET_CALL 146559
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-mellow-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-fabric-iris-mellow-in-world.tgz
|
||||
@@ -464,8 +448,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-mellow-in-world
|
||||
TARGET_CALL 96143
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-nostalgia-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-fabric-iris-nostalgia-in-world.tgz
|
||||
@@ -475,8 +458,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-nostalgia-in-wor
|
||||
TARGET_CALL 153808
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-bliss-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-fabric-iris-bliss-in-world.tgz
|
||||
@@ -485,8 +467,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-bliss-in-world
|
||||
TARGET_CALL 113511
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-chocapic-v6-lite-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-fabric-iris-chocapic-v6-lite-in-world.tgz
|
||||
@@ -495,8 +476,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-chocapic-v6-lite
|
||||
TARGET_CALL 125124
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-iterationt-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-fabric-iris-iterationt-in-world.tgz
|
||||
@@ -505,8 +485,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-iterationt-in-wo
|
||||
TARGET_CALL 1173280
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-iterationt-nodsa-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-fabric-iris-iterationt-nodsa-in-world.tgz
|
||||
@@ -515,8 +494,7 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-iterationt-nodsa
|
||||
TARGET_CALL 1606997
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-photon-v1.1-in-world
|
||||
TRACE_ARCHIVE ${MOBILEGL_TRACE_ROOT}/fixtures/minecraft-1.21.4-fabric-iris-photon-v1.1-in-world.tgz
|
||||
@@ -525,5 +503,4 @@ add_trace_replay_test_for_backends(minecraft-1.21.4-fabric-iris-photon-v1.1-in-w
|
||||
TARGET_CALL 159866
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 4100
|
||||
FUZZ_PERCENT 20)
|
||||
)
|
||||
|
||||
@@ -94,8 +94,7 @@ build-test/tools/trace_replay/mobilegl_trace_replay \
|
||||
--crop-y 1 \
|
||||
--crop-width 638 \
|
||||
--crop-height 478 \
|
||||
--tolerance 20 \
|
||||
--fuzz-percent 20
|
||||
--ssim-threshold 0.99
|
||||
```
|
||||
|
||||
## Android device replay
|
||||
@@ -140,8 +139,7 @@ adb shell am start -W -a top.mobilegl.plugin.TRACE_REPLAY \
|
||||
--ei crop_y 1 \
|
||||
--ei crop_width 638 \
|
||||
--ei crop_height 478 \
|
||||
--ei tolerance 20 \
|
||||
--ei fuzz_percent 20
|
||||
--es ssim_threshold 0.99
|
||||
```
|
||||
|
||||
Read back the result and images:
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
foreach(required TRACE_REPLAY_EXE MOBILEGL_LIBRARY OPENRA_TRACE_ARCHIVE OPENRA_GOLDEN OPENRA_OUTPUT_DIR OPENRA_BACKEND)
|
||||
if(NOT DEFINED ${required} OR "${${required}}" STREQUAL "")
|
||||
message(FATAL_ERROR "${required} is required")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(EXISTS "${OPENRA_OUTPUT_DIR}")
|
||||
file(REMOVE_RECURSE "${OPENRA_OUTPUT_DIR}")
|
||||
endif()
|
||||
file(MAKE_DIRECTORY "${OPENRA_OUTPUT_DIR}/input")
|
||||
file(MAKE_DIRECTORY "${OPENRA_OUTPUT_DIR}/output")
|
||||
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_COMMAND}" -E tar xzf "${OPENRA_TRACE_ARCHIVE}"
|
||||
WORKING_DIRECTORY "${OPENRA_OUTPUT_DIR}/input"
|
||||
RESULT_VARIABLE extract_result
|
||||
OUTPUT_VARIABLE extract_stdout
|
||||
ERROR_VARIABLE extract_stderr)
|
||||
if(NOT extract_result EQUAL 0)
|
||||
message(STATUS "${extract_stdout}")
|
||||
message(STATUS "${extract_stderr}")
|
||||
message(FATAL_ERROR "failed to extract ${OPENRA_TRACE_ARCHIVE}")
|
||||
endif()
|
||||
|
||||
set(openra_trace "${OPENRA_OUTPUT_DIR}/input/openra.trace")
|
||||
if(NOT EXISTS "${openra_trace}")
|
||||
message(FATAL_ERROR "extracted OpenRA trace was not found at ${openra_trace}")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${TRACE_REPLAY_EXE}"
|
||||
--trace "${openra_trace}"
|
||||
--golden "${OPENRA_GOLDEN}"
|
||||
--output "${OPENRA_OUTPUT_DIR}/output"
|
||||
--backend "${OPENRA_BACKEND}"
|
||||
--mobilegl-library "${MOBILEGL_LIBRARY}"
|
||||
--target-call 31249
|
||||
--width 640
|
||||
--height 480
|
||||
--tolerance 20
|
||||
--crop-x 1
|
||||
--crop-y 1
|
||||
--crop-width 638
|
||||
--crop-height 478
|
||||
--fuzz-percent 20
|
||||
RESULT_VARIABLE replay_result
|
||||
OUTPUT_VARIABLE replay_stdout
|
||||
ERROR_VARIABLE replay_stderr)
|
||||
|
||||
message(STATUS "${replay_stdout}")
|
||||
message(STATUS "${replay_stderr}")
|
||||
|
||||
set(retrace_log "${OPENRA_OUTPUT_DIR}/output/retrace.log")
|
||||
set(mobilegl_log "${OPENRA_OUTPUT_DIR}/output/mobilegl.log")
|
||||
if(EXISTS "${retrace_log}")
|
||||
file(STRINGS "${retrace_log}" gl_identity_lines REGEX "MOBILEGL_TRACE_GL_")
|
||||
foreach(line IN LISTS gl_identity_lines)
|
||||
message(STATUS "${line}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
set(result_json "${OPENRA_OUTPUT_DIR}/output/result.json")
|
||||
if(DEFINED OPENRA_ARTIFACT_DIR AND NOT "${OPENRA_ARTIFACT_DIR}" STREQUAL "")
|
||||
file(MAKE_DIRECTORY "${OPENRA_ARTIFACT_DIR}")
|
||||
set(actual_png "${OPENRA_OUTPUT_DIR}/output/actual.png")
|
||||
if(EXISTS "${actual_png}")
|
||||
file(COPY_FILE "${actual_png}" "${OPENRA_ARTIFACT_DIR}/openra-${OPENRA_BACKEND}-actual.png")
|
||||
endif()
|
||||
if(EXISTS "${result_json}")
|
||||
file(COPY_FILE "${result_json}" "${OPENRA_ARTIFACT_DIR}/openra-${OPENRA_BACKEND}-result.json")
|
||||
endif()
|
||||
if(EXISTS "${retrace_log}")
|
||||
file(COPY_FILE "${retrace_log}" "${OPENRA_ARTIFACT_DIR}/openra-${OPENRA_BACKEND}-retrace.log")
|
||||
endif()
|
||||
if(EXISTS "${mobilegl_log}")
|
||||
file(COPY_FILE "${mobilegl_log}" "${OPENRA_ARTIFACT_DIR}/openra-${OPENRA_BACKEND}-mobilegl.log")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(EXISTS "${result_json}")
|
||||
file(READ "${result_json}" result_contents)
|
||||
message(STATUS "${result_contents}")
|
||||
else()
|
||||
if(EXISTS "${retrace_log}")
|
||||
file(READ "${retrace_log}" retrace_log_contents)
|
||||
message(STATUS "${retrace_log_contents}")
|
||||
endif()
|
||||
if(EXISTS "${mobilegl_log}")
|
||||
file(READ "${mobilegl_log}" mobilegl_log_contents)
|
||||
message(STATUS "${mobilegl_log_contents}")
|
||||
endif()
|
||||
message(FATAL_ERROR "trace replay did not write ${result_json}")
|
||||
endif()
|
||||
|
||||
if(NOT replay_result EQUAL 0)
|
||||
message(FATAL_ERROR "OpenRA ${OPENRA_BACKEND} trace replay failed with status ${replay_result}")
|
||||
endif()
|
||||
@@ -4,8 +4,8 @@ foreach(required TRACE_REPLAY_EXE MOBILEGL_LIBRARY TRACE_ARCHIVE TRACE_FILE TRAC
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT DEFINED TRACE_TOLERANCE OR "${TRACE_TOLERANCE}" STREQUAL "")
|
||||
set(TRACE_TOLERANCE 0)
|
||||
if(NOT DEFINED TRACE_SSIM_THRESHOLD OR "${TRACE_SSIM_THRESHOLD}" STREQUAL "")
|
||||
set(TRACE_SSIM_THRESHOLD 0.99)
|
||||
endif()
|
||||
if(NOT DEFINED TRACE_CROP_X OR "${TRACE_CROP_X}" STREQUAL "")
|
||||
set(TRACE_CROP_X 0)
|
||||
@@ -19,9 +19,6 @@ endif()
|
||||
if(NOT DEFINED TRACE_CROP_HEIGHT OR "${TRACE_CROP_HEIGHT}" STREQUAL "")
|
||||
set(TRACE_CROP_HEIGHT 0)
|
||||
endif()
|
||||
if(NOT DEFINED TRACE_FUZZ_PERCENT OR "${TRACE_FUZZ_PERCENT}" STREQUAL "")
|
||||
set(TRACE_FUZZ_PERCENT 20)
|
||||
endif()
|
||||
set(alternate_golden_args)
|
||||
if(DEFINED TRACE_ALTERNATE_GOLDEN AND NOT "${TRACE_ALTERNATE_GOLDEN}" STREQUAL "")
|
||||
list(APPEND alternate_golden_args --alternate-golden "${TRACE_ALTERNATE_GOLDEN}")
|
||||
@@ -62,12 +59,11 @@ execute_process(
|
||||
--target-call "${TRACE_TARGET_CALL}"
|
||||
--width "${TRACE_WIDTH}"
|
||||
--height "${TRACE_HEIGHT}"
|
||||
--tolerance "${TRACE_TOLERANCE}"
|
||||
--ssim-threshold "${TRACE_SSIM_THRESHOLD}"
|
||||
--crop-x "${TRACE_CROP_X}"
|
||||
--crop-y "${TRACE_CROP_Y}"
|
||||
--crop-width "${TRACE_CROP_WIDTH}"
|
||||
--crop-height "${TRACE_CROP_HEIGHT}"
|
||||
--fuzz-percent "${TRACE_FUZZ_PERCENT}"
|
||||
RESULT_VARIABLE replay_result
|
||||
OUTPUT_VARIABLE replay_stdout
|
||||
ERROR_VARIABLE replay_stderr)
|
||||
|
||||
@@ -40,8 +40,9 @@ The golden and target environments must use the same trace, surface size, target
|
||||
call numbers, and comparison crop. They do not need to report the same GL vendor,
|
||||
renderer, version, or extension set. The only requirement for the golden
|
||||
environment is that it can replay the case and pass the fixture's golden image
|
||||
test. Disable overlays and avoid tolerance/fuzz while localizing the first
|
||||
divergent call unless the known golden already has small nondeterministic noise.
|
||||
test. Disable overlays and use a strict SSIM threshold while localizing the
|
||||
first divergent call unless the known golden already has small nondeterministic
|
||||
noise.
|
||||
|
||||
## Prepare two replay environments
|
||||
|
||||
@@ -80,8 +81,7 @@ mkdir -p "$WORK/$CASE"
|
||||
--target-call "$TARGET_CALL" \
|
||||
--width "$WIDTH" \
|
||||
--height "$HEIGHT" \
|
||||
--tolerance 0 \
|
||||
--fuzz-percent 0 > "$WORK/$CASE/target-retrace.log" 2>&1 || true
|
||||
--ssim-threshold 1.0 > "$WORK/$CASE/target-retrace.log" 2>&1 || true
|
||||
```
|
||||
|
||||
Keep target GL identity lines such as `MOBILEGL_TRACE_GL_VENDOR`,
|
||||
@@ -90,7 +90,7 @@ Keep target GL identity lines such as `MOBILEGL_TRACE_GL_VENDOR`,
|
||||
reject a golden environment because its GL strings differ from the target.
|
||||
|
||||
For Android, use `android-plugin/trace-replay-ci.sh` with the same trace,
|
||||
golden, target call, width, height, crop, tolerance, and fuzz values. Pull
|
||||
golden, target call, width, height, crop, and SSIM threshold values. Pull
|
||||
`result.json`, `actual.png`, `diff.png`, `retrace.log`, and `logcat.txt` before
|
||||
continuing.
|
||||
|
||||
@@ -151,8 +151,7 @@ for call in 1000 1250 1430 1700; do
|
||||
--target-call "$call" \
|
||||
--width "$WIDTH" \
|
||||
--height "$HEIGHT" \
|
||||
--tolerance 0 \
|
||||
--fuzz-percent 0 || true
|
||||
--ssim-threshold 1.0 || true
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
@@ -173,8 +173,7 @@ add_trace_replay_test_for_backends(case-name
|
||||
TARGET_CALL 0
|
||||
WIDTH 854
|
||||
HEIGHT 480
|
||||
TOLERANCE 20
|
||||
FUZZ_PERCENT 20)
|
||||
SSIM_THRESHOLD 0.99)
|
||||
```
|
||||
|
||||
Optional crop:
|
||||
@@ -191,13 +190,13 @@ Optional crop:
|
||||
Edit `.github/workflows/apk.yml` `TRACE_REPLAY_CASES`:
|
||||
|
||||
```text
|
||||
case-name|tools/trace_replay/fixtures/case-name.tgz|trace.trace|tools/trace_replay/fixtures/case-name.0000000000.png|0|854|480|20|0|0|0|0|20|900
|
||||
case-name|tools/trace_replay/fixtures/case-name.tgz|trace.trace|tools/trace_replay/fixtures/case-name.0000000000.png|0|854|480|0.99|0|0|0|0|900
|
||||
```
|
||||
|
||||
Field order:
|
||||
|
||||
```text
|
||||
case|trace archive|trace file|golden|target call|width|height|tolerance|crop x|crop y|crop width|crop height|fuzz percent|timeout seconds
|
||||
case|trace archive|trace file|golden|target call|width|height|ssim threshold|crop x|crop y|crop width|crop height|timeout seconds
|
||||
```
|
||||
|
||||
Update `tools/trace_replay/README.md` with one fixture sentence and one golden
|
||||
@@ -236,12 +235,11 @@ cmake \
|
||||
-DTRACE_TARGET_CALL="$TARGET_CALL" \
|
||||
-DTRACE_WIDTH="$WIDTH" \
|
||||
-DTRACE_HEIGHT="$HEIGHT" \
|
||||
-DTRACE_TOLERANCE=20 \
|
||||
-DTRACE_SSIM_THRESHOLD=0.99 \
|
||||
-DTRACE_CROP_X=0 \
|
||||
-DTRACE_CROP_Y=0 \
|
||||
-DTRACE_CROP_WIDTH=0 \
|
||||
-DTRACE_CROP_HEIGHT=0 \
|
||||
-DTRACE_FUZZ_PERCENT=20 \
|
||||
-DTRACE_OUTPUT_DIR="$WORK/$CASE/linux-DirectGLES" \
|
||||
-DTRACE_ARTIFACT_DIR="$WORK/$CASE/linux-artifacts" \
|
||||
-P "$REPO/tools/trace_replay/run_trace_case.cmake"
|
||||
@@ -292,12 +290,11 @@ sh "$REPO/android-plugin/trace-replay-ci.sh" \
|
||||
--target-call "$TARGET_CALL" \
|
||||
--width "$WIDTH" \
|
||||
--height "$HEIGHT" \
|
||||
--tolerance 20 \
|
||||
--ssim-threshold 0.99 \
|
||||
--crop-x 0 \
|
||||
--crop-y 0 \
|
||||
--crop-width 0 \
|
||||
--crop-height 0 \
|
||||
--fuzz-percent 20 \
|
||||
--timeout-seconds 900
|
||||
```
|
||||
|
||||
|
||||
@@ -20,8 +20,7 @@ void PrintUsage(const char *argv0) {
|
||||
<< " --mobilegl-library PATH libMobileGL.so path (default: libMobileGL.so)\n"
|
||||
<< " --width N Replay surface width override\n"
|
||||
<< " --height N Replay surface height override\n"
|
||||
<< " --tolerance N Allowed mismatch pixels\n"
|
||||
<< " --fuzz-percent N Per-channel fuzz threshold, 0-100 (default: 20)\n"
|
||||
<< " --ssim-threshold N Minimum SSIM required to pass (default: 0.99)\n"
|
||||
<< " --crop-x N Compare crop x\n"
|
||||
<< " --crop-y N Compare crop y\n"
|
||||
<< " --crop-width N Compare crop width\n"
|
||||
@@ -55,9 +54,17 @@ bool ReadLongLong(int argc, char **argv, int &index, long long &out) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadDouble(int argc, char **argv, int &index, double &out) {
|
||||
std::string value;
|
||||
if (!ReadValue(argc, argv, index, value)) {
|
||||
return false;
|
||||
}
|
||||
out = std::strtod(value.c_str(), nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParseArgs(int argc, char **argv, mobilegl_trace::Request &request) {
|
||||
request.backend = "DirectGLES";
|
||||
request.fuzzPercent = 20;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
const std::string arg = argv[i];
|
||||
@@ -87,8 +94,8 @@ bool ParseArgs(int argc, char **argv, mobilegl_trace::Request &request) {
|
||||
if (!ReadInt(argc, argv, i, request.width)) return false;
|
||||
} else if (arg == "--height") {
|
||||
if (!ReadInt(argc, argv, i, request.height)) return false;
|
||||
} else if (arg == "--tolerance") {
|
||||
if (!ReadInt(argc, argv, i, request.tolerance)) return false;
|
||||
} else if (arg == "--ssim-threshold") {
|
||||
if (!ReadDouble(argc, argv, i, request.ssimThreshold)) return false;
|
||||
} else if (arg == "--crop-x") {
|
||||
if (!ReadInt(argc, argv, i, request.cropX)) return false;
|
||||
} else if (arg == "--crop-y") {
|
||||
@@ -97,8 +104,6 @@ bool ParseArgs(int argc, char **argv, mobilegl_trace::Request &request) {
|
||||
if (!ReadInt(argc, argv, i, request.cropWidth)) return false;
|
||||
} else if (arg == "--crop-height") {
|
||||
if (!ReadInt(argc, argv, i, request.cropHeight)) return false;
|
||||
} else if (arg == "--fuzz-percent") {
|
||||
if (!ReadInt(argc, argv, i, request.fuzzPercent)) return false;
|
||||
} else if (arg == "--help" || arg == "-h") {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user