perf: harden runtime for weaker hardware

This commit is contained in:
Rijad Zuzo
2026-08-12 10:02:45 +02:00
parent cd29da95e0
commit 34428d836a
47 changed files with 2164 additions and 243 deletions
+61
View File
@@ -26,6 +26,8 @@ CROSS_PLATFORM_PLUGIN_FILES=(
addons/terrain_3d/bin/libterrain.windows.release.x86_64.dll
)
REQUIRED_GODOT_SERIES="4.7"
RUNNING_ON_MACOS=false
[[ "${OSTYPE:-}" == darwin* ]] && RUNNING_ON_MACOS=true
# -- tool detection -----------------------------------------------------------
console_godot_path() {
@@ -143,6 +145,31 @@ contains_element() {
local e; for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done; return 1
}
is_allowed_scenario_diagnostic() {
local diagnostic="$1"
# Godot 4.7 can fail to read the system certificate store on macOS when HOME
# is intentionally isolated. Scenario tests do not perform network access.
if $RUNNING_ON_MACOS &&
[[ "$diagnostic" == 'ERROR: Condition "ret != noErr" is true. Returning: ""' ]]; then
return 0
fi
# Pinned Terrain3D 1.0.2 invokes this Godot 4.7 compatibility method while
# loading its vendored GDExtension. Remove this exception with that vendor fix.
if [[ "$diagnostic" == "WARNING: instance_reset_physics_interpolation() is deprecated." ]]; then
return 0
fi
# Godot 4.7's dummy headless renderer retains exactly one DummyShader RID at
# process teardown. A different RID type or count remains a gate failure.
if [[ "$diagnostic" == "ERROR: 1 RID allocations of type 'N13RendererDummy15MaterialStorage11DummyShaderE' were leaked at exit." ]]; then
return 0
fi
return 1
}
run_with_timeout() {
local seconds="$1"
shift
@@ -380,6 +407,40 @@ for test in tests/*_test.gd; do
ERRORS+=("scenario: $(basename "$test") failed or timed out")
fi
done
compatibility_test="tests/jajce_presentation_quality_test.gd"
compatibility_label="$(basename "$compatibility_test") (gl_compatibility)"
echo "[RUN] $compatibility_label" >> "$LOG/scenarios.log"
if ! run_with_timeout 30 "${GODOT_ENV[@]}" "$GODOT" --headless --rendering-method gl_compatibility --path "$ROOT" --script "res://$compatibility_test" >> "$LOG/scenarios.log" 2>&1; then
scenario_result="FAIL"
ERRORS+=("scenario: $compatibility_label failed or timed out")
fi
unexpected_scenario_diagnostics=()
current_scenario="unknown scenario"
while IFS= read -r raw_line; do
raw_line="${raw_line%$'\r'}"
if [[ "$raw_line" == "[RUN] "* ]]; then
current_scenario="${raw_line#* }"
continue
fi
diagnostic="$raw_line"
diagnostic="${diagnostic#"${diagnostic%%[![:space:]]*}"}"
diagnostic="${diagnostic%"${diagnostic##*[![:space:]]}"}"
if [[ ! "$diagnostic" =~ ^((SCRIPT[[:space:]])?ERROR|WARNING): ]]; then
continue
fi
if ! is_allowed_scenario_diagnostic "$diagnostic"; then
unexpected_scenario_diagnostics+=("$current_scenario: $diagnostic")
fi
done < "$LOG/scenarios.log"
if [[ ${#unexpected_scenario_diagnostics[@]} -gt 0 ]]; then
scenario_result="FAIL"
ERRORS+=(
"scenario: Godot reported ${#unexpected_scenario_diagnostics[@]} unallowlisted ERROR/WARNING diagnostic(s)"
)
for diagnostic in "${unexpected_scenario_diagnostics[@]:0:20}"; do
ERRORS+=("scenario: $diagnostic")
done
fi
if grep -qE "SCRIPT ERROR:|Parse Error:|Failed to load script" "$LOG/scenarios.log"; then
scenario_result="FAIL"
ERRORS+=("scenario: Godot reported a script load or parse error")