native: perf telemetry, 2 frames in flight, 120 Hz pacing, GPU shadow map

- --perf-log CSV + logcat telemetry (perf_log.h, EterBase/PerfCounters.h),
  incl. display refresh rate / app vsync rate, thermal, CPU clocks;
  tools/pull_perf_logs.sh + tools/perf_summary.py
- Vulkan renderer: two frames in flight, in-frame texture uploads (no
  vkQueueWaitIdle), --fps-cap / --refresh-rate / --frames-in-flight
- Android: ANativeWindow_setFrameRate, ADPF performance hint,
  appCategory=game (ColorOS no longer drops to 60 Hz when idle)
- Character shadow map rendered on the GPU into an offscreen render target
  instead of CPU rasterization + per-frame 1 MB upload; --cpu-shadow keeps
  the old path. Device (120 Hz, 32 mobs): 75 -> ~115 fps, script thread
  8.9 -> 3.4 ms. draw_capture format v10.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-29 17:59:23 +09:00
co-authored by Claude Opus 5.5
parent 3e3708ef06
commit c2cc093ed0
16 changed files with 1883 additions and 261 deletions
@@ -50,6 +50,7 @@
#include "../EterBase/LogBox.h"
#include "../UserInterface/ServerClock.h"
#include <atomic>
#include <condition_variable>
#include <cstdlib>
#include <filesystem>
@@ -61,6 +62,9 @@
#include <signal.h>
#include <unistd.h>
#endif
#if defined(__linux__) || defined(__ANDROID__)
#include <unistd.h>
#endif
namespace
{
@@ -185,6 +189,7 @@ struct ScriptFiber
};
ScriptFiber g_fiber;
thread_local bool t_on_fiber = false;
std::atomic<int> g_script_thread_id{0};
// Caller holds the GIL. Returns with the GIL held again after the script has given the baton back.
void hand_to_script()
@@ -218,6 +223,9 @@ void* fiber_main(void*)
g_fiber.cv.wait(lock, [] { return g_fiber.turn == ScriptFiber::Script; });
}
t_on_fiber = true;
#if defined(__linux__) || defined(__ANDROID__)
g_script_thread_id = int(gettid());
#endif
PyGILState_STATE gil = PyGILState_Ensure();
std::string error;
const bool ok = run_main_script_body(g_fiber.command_line.c_str(), &error);
@@ -927,6 +935,11 @@ bool RunMainScript(const char* lpCmdLine, std::string* error)
return true;
}
int ScriptThreadId()
{
return g_script_thread_id;
}
bool IsAppLooping()
{
return g_fiber.alive && g_fiber.looping && !g_fiber.finished;