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
+11 -3
View File
@@ -28,7 +28,7 @@
namespace native_draw_capture {
struct Capture {
std::uint32_t version = 9;
std::uint32_t version = 10;
std::vector<Render3DDraw> draws;
std::unordered_map<std::string, std::vector<std::uint8_t>> textures;
std::uint32_t ui_width = 960;
@@ -114,7 +114,7 @@ inline void write(
std::ofstream file(path, std::ios::binary | std::ios::trunc);
if (!file) throw std::runtime_error("cannot create native draw capture: " + path);
const std::uint32_t magic = 0x4d544452; // MTDR
const std::uint32_t version = 9;
const std::uint32_t version = 10;
const auto count = static_cast<std::uint32_t>(draws.size());
write_scalar(file, magic); write_scalar(file, version); write_scalar(file, count);
for (const auto& draw : draws) {
@@ -193,6 +193,9 @@ inline void write(
write_vector(file, draw.bone_indices);
write_vector(file, draw.bone_weights);
write_vector(file, draw.bone_matrices);
write_scalar(file, draw.render_target);
write_scalar(file, draw.target_width);
write_scalar(file, draw.target_height);
}
const auto texture_count = static_cast<std::uint32_t>(textures.size());
write_scalar(file, texture_count);
@@ -239,7 +242,7 @@ inline Capture read_capture(const std::string& path) {
if (!file) throw std::runtime_error("cannot open native draw capture: " + path);
std::uint32_t magic = 0, version = 0, count = 0;
read_scalar(file, magic); read_scalar(file, version); read_scalar(file, count);
if (magic != 0x4d544452 || (version < 1 || version > 9) || count > 10'000)
if (magic != 0x4d544452 || (version < 1 || version > 10) || count > 10'000)
throw std::runtime_error("unsupported native draw capture format");
Capture capture;
capture.version = version;
@@ -348,6 +351,11 @@ inline Capture read_capture(const std::string& path) {
read_vector(file, draw.bone_weights);
read_vector(file, draw.bone_matrices);
}
if (version >= 10) {
read_scalar(file, draw.render_target);
read_scalar(file, draw.target_width);
read_scalar(file, draw.target_height);
}
}
if (version >= 3) {
std::uint32_t texture_count = 0;