// Vulkan 后端的平台钩子(移植自 dodola/d2r-mobile 的 android/nvn_platform_*):单调时钟 + 前端交给后端的窗口 / 着色器目录 // Platform hooks of the Vulkan backend (ported from android/nvn_platform_* of dodola/d2r-mobile): monotonic clock + window / shader directory handed over by the front end #pragma once #include #include #include static inline uint64_t dm_android_nvn_clock_ns(void) { struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); return (uint64_t)t.tv_sec * 1000000000ull + (uint64_t)t.tv_nsec; } void dm_vk_set_shader_root(const char *path); // 着色器运行包目录(shader_index.bin / *.vkmeta / *.spv.gz) | shader runtime pack directory void dm_vk_set_window(void *native); // ANativeWindow*;NULL = 无头(不上屏,只按需读回) | ANativeWindow*; NULL = headless (no swapchain, readback on demand) void dm_vk_set_display_hz(int hz); // on = 1:没有窗口时出图阻塞到 dm_vk_set_window 给回窗口(App 切后台);0 = 无头照常跑 | on = 1: with no window, present blocks until dm_vk_set_window returns one (app in background); 0 = headless runs as usual void dm_vk_hold_without_window(int on); void *dm_vk_native_window(void);