release: bump version to 0.79.1
This commit is contained in:
1 parent
1e9508f2f1
commit
352b34e7c6
20 files changed
+1523
-46
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "planet-client",
|
||||
"version": "0.79.0",
|
||||
"version": "0.79.1",
|
||||
"description": "Intelligent Planet Program - Native Electron Earth Viewer",
|
||||
"private": true,
|
||||
"packageManager": "bun@1",
|
||||
|
||||
+137
-12
@@ -2,6 +2,7 @@ import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
||||
export type SplashTheme = 'singularity' | 'off'
|
||||
export type GpuRenderMode = 'auto' | 'high-performance' | 'low-power' | 'software'
|
||||
|
||||
export interface ServerEndpoints {
|
||||
backendUrl: string
|
||||
@@ -11,6 +12,23 @@ export interface ServerEndpoints {
|
||||
|
||||
export interface PersistedUserConfig extends Partial<ServerEndpoints> {
|
||||
splashTheme?: SplashTheme
|
||||
gpuMode?: GpuRenderMode
|
||||
}
|
||||
|
||||
export type GpuHandoffTarget = 'default' | 'high-performance' | 'low-power' | 'software'
|
||||
|
||||
export function normalizeGpuHandoffTarget(raw: unknown): GpuHandoffTarget | undefined {
|
||||
if (typeof raw !== 'string') return undefined
|
||||
const normalized = raw.trim().toLowerCase()
|
||||
if (
|
||||
normalized === 'default' ||
|
||||
normalized === 'high-performance' ||
|
||||
normalized === 'low-power' ||
|
||||
normalized === 'software'
|
||||
) {
|
||||
return normalized
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
export interface DesktopLaunchFlags {
|
||||
@@ -22,11 +40,15 @@ export interface DesktopLaunchFlags {
|
||||
smokeOutputPath: string | null
|
||||
deepLinkUrl: string | null
|
||||
splashThemeOverride?: SplashTheme
|
||||
gpuModeOverride?: GpuRenderMode
|
||||
gpuHandoff: boolean
|
||||
gpuHandoffTarget?: GpuHandoffTarget
|
||||
}
|
||||
|
||||
export interface DesktopRuntimeConfig extends ServerEndpoints, DesktopLaunchFlags {
|
||||
wsUrl: string
|
||||
splashTheme: SplashTheme
|
||||
gpuMode: GpuRenderMode
|
||||
}
|
||||
|
||||
const LEGACY_ACTIVE_THEMES: ReadonlySet<string> = new Set([
|
||||
@@ -47,6 +69,35 @@ export function normalizeSplashTheme(
|
||||
return LEGACY_ACTIVE_THEMES.has(normalized) ? 'singularity' : fallback
|
||||
}
|
||||
|
||||
export function normalizeGpuMode(
|
||||
raw: unknown,
|
||||
fallback: GpuRenderMode = 'auto',
|
||||
): GpuRenderMode {
|
||||
if (typeof raw !== 'string') return fallback
|
||||
const normalized = raw.trim().toLowerCase()
|
||||
if (normalized === 'auto') return 'auto'
|
||||
if (
|
||||
normalized === 'high-performance' ||
|
||||
normalized === 'high' ||
|
||||
normalized === 'discrete' ||
|
||||
normalized === 'dgpu'
|
||||
) {
|
||||
return 'high-performance'
|
||||
}
|
||||
if (
|
||||
normalized === 'low-power' ||
|
||||
normalized === 'low' ||
|
||||
normalized === 'integrated' ||
|
||||
normalized === 'igpu'
|
||||
) {
|
||||
return 'low-power'
|
||||
}
|
||||
if (normalized === 'software' || normalized === 'cpu' || normalized === 'swiftshader') {
|
||||
return 'software'
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
|
||||
export const DEFAULT_ENDPOINTS: Readonly<ServerEndpoints> = {
|
||||
backendUrl: 'https://rclaw.top',
|
||||
adminUrl: 'https://admin.rclaw.top',
|
||||
@@ -115,6 +166,7 @@ export function parseLaunchArgs(argv: string[]): {
|
||||
headlessSmoke: false,
|
||||
smokeOutputPath: null,
|
||||
deepLinkUrl: null,
|
||||
gpuHandoff: false,
|
||||
}
|
||||
|
||||
for (let i = 0; i < argv.length; i += 1) {
|
||||
@@ -136,6 +188,22 @@ export function parseLaunchArgs(argv: string[]): {
|
||||
flags.splashThemeOverride = normalizeSplashTheme(arg.slice('--splash-theme='.length))
|
||||
} else if (arg === '--splash-theme' && argv[i + 1]) {
|
||||
flags.splashThemeOverride = normalizeSplashTheme(argv[++i])
|
||||
} else if (arg.startsWith('--gpu-mode=')) {
|
||||
flags.gpuModeOverride = normalizeGpuMode(arg.slice('--gpu-mode='.length))
|
||||
} else if (arg === '--gpu-mode' && argv[i + 1]) {
|
||||
flags.gpuModeOverride = normalizeGpuMode(argv[++i])
|
||||
} else if (arg === '--software-gl') {
|
||||
flags.gpuModeOverride = 'software'
|
||||
} else if (arg === '--low-power-gpu') {
|
||||
flags.gpuModeOverride = 'low-power'
|
||||
} else if (arg === '--high-performance-gpu') {
|
||||
flags.gpuModeOverride = 'high-performance'
|
||||
} else if (arg === '--gpu-handoff') {
|
||||
flags.gpuHandoff = true
|
||||
} else if (arg.startsWith('--gpu-handoff-target=')) {
|
||||
flags.gpuHandoffTarget = normalizeGpuHandoffTarget(arg.slice('--gpu-handoff-target='.length))
|
||||
} else if (arg === '--gpu-handoff-target' && argv[i + 1]) {
|
||||
flags.gpuHandoffTarget = normalizeGpuHandoffTarget(argv[++i])
|
||||
} else if (arg === '--fullscreen') {
|
||||
flags.fullscreen = true
|
||||
} else if (arg === '--kiosk') {
|
||||
@@ -157,6 +225,55 @@ export function parseLaunchArgs(argv: string[]): {
|
||||
return { endpoints, flags }
|
||||
}
|
||||
|
||||
function getPortableConfigPaths(exeDir: string, resourcesDir?: string): string[] {
|
||||
const candidates: string[] = []
|
||||
if (exeDir) {
|
||||
candidates.push(path.join(exeDir, 'planet-earth.json'))
|
||||
}
|
||||
if (resourcesDir) {
|
||||
candidates.push(path.join(resourcesDir, 'planet-earth.json'))
|
||||
}
|
||||
return candidates
|
||||
}
|
||||
|
||||
function readFirstPortableConfig(paths: string[]): PersistedUserConfig {
|
||||
for (const candidate of paths) {
|
||||
const data = readJsonFileSafe(candidate)
|
||||
if (Object.keys(data).length > 0) {
|
||||
return data
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
export function readPreReadyGpuMode(options: {
|
||||
userDataDir: string
|
||||
exeDir: string
|
||||
resourcesDir?: string
|
||||
argv: string[]
|
||||
env?: NodeJS.ProcessEnv
|
||||
}): GpuRenderMode {
|
||||
const env = options.env ?? process.env
|
||||
const { flags } = parseLaunchArgs(options.argv)
|
||||
const portable = readFirstPortableConfig(getPortableConfigPaths(options.exeDir, options.resourcesDir))
|
||||
const userSaved = options.userDataDir ? readJsonFileSafe(path.join(options.userDataDir, 'config.json')) : {}
|
||||
return normalizeGpuMode(
|
||||
flags.gpuModeOverride ?? env.PLANET_GPU_MODE ?? portable.gpuMode ?? userSaved.gpuMode,
|
||||
'auto',
|
||||
)
|
||||
}
|
||||
|
||||
export function readPreReadyGpuHandoff(argv: string[]): {
|
||||
gpuHandoff: boolean
|
||||
gpuHandoffTarget?: GpuHandoffTarget
|
||||
} {
|
||||
const { flags } = parseLaunchArgs(argv)
|
||||
return {
|
||||
gpuHandoff: flags.gpuHandoff,
|
||||
gpuHandoffTarget: flags.gpuHandoffTarget,
|
||||
}
|
||||
}
|
||||
|
||||
export class DesktopConfigStore {
|
||||
private readonly userConfigPath: string
|
||||
private readonly portableConfigPaths: string[]
|
||||
@@ -172,10 +289,7 @@ export class DesktopConfigStore {
|
||||
env?: NodeJS.ProcessEnv
|
||||
}) {
|
||||
this.userConfigPath = path.join(options.userDataDir, 'config.json')
|
||||
this.portableConfigPaths = [
|
||||
path.join(options.exeDir, 'planet-earth.json'),
|
||||
...(options.resourcesDir ? [path.join(options.resourcesDir, 'planet-earth.json')] : []),
|
||||
]
|
||||
this.portableConfigPaths = getPortableConfigPaths(options.exeDir, options.resourcesDir)
|
||||
const parsed = parseLaunchArgs(options.argv)
|
||||
this.cliEndpoints = parsed.endpoints
|
||||
this.launchFlags = parsed.flags
|
||||
@@ -184,14 +298,7 @@ export class DesktopConfigStore {
|
||||
|
||||
private resolve(env: NodeJS.ProcessEnv): DesktopRuntimeConfig {
|
||||
const userSaved = readJsonFileSafe(this.userConfigPath)
|
||||
let portable: PersistedUserConfig = {}
|
||||
for (const candidate of this.portableConfigPaths) {
|
||||
const data = readJsonFileSafe(candidate)
|
||||
if (Object.keys(data).length > 0) {
|
||||
portable = data
|
||||
break
|
||||
}
|
||||
}
|
||||
const portable = readFirstPortableConfig(this.portableConfigPaths)
|
||||
|
||||
const backendUrl = normalizeHttpUrl(
|
||||
this.cliEndpoints.backendUrl ?? env.PLANET_BACKEND_URL ?? portable.backendUrl ?? userSaved.backendUrl,
|
||||
@@ -212,6 +319,13 @@ export class DesktopConfigStore {
|
||||
userSaved.splashTheme,
|
||||
'singularity',
|
||||
)
|
||||
const gpuMode = normalizeGpuMode(
|
||||
this.launchFlags.gpuModeOverride ??
|
||||
env.PLANET_GPU_MODE ??
|
||||
portable.gpuMode ??
|
||||
userSaved.gpuMode,
|
||||
'auto',
|
||||
)
|
||||
|
||||
return {
|
||||
backendUrl,
|
||||
@@ -219,6 +333,7 @@ export class DesktopConfigStore {
|
||||
motionWsUrl,
|
||||
wsUrl: deriveBackendWsUrl(backendUrl),
|
||||
splashTheme,
|
||||
gpuMode,
|
||||
...this.launchFlags,
|
||||
}
|
||||
}
|
||||
@@ -260,4 +375,14 @@ export class DesktopConfigStore {
|
||||
}
|
||||
return this.get()
|
||||
}
|
||||
|
||||
updateGpuMode(rawMode: unknown): DesktopRuntimeConfig {
|
||||
const nextMode = normalizeGpuMode(rawMode, this.current.gpuMode)
|
||||
this.writeUserConfig({ gpuMode: nextMode })
|
||||
this.current = {
|
||||
...this.current,
|
||||
gpuMode: nextMode,
|
||||
}
|
||||
return this.get()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
import { execFile, execFileSync } from 'node:child_process'
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { promisify } from 'node:util'
|
||||
|
||||
import type { BrowserWindow } from 'electron'
|
||||
|
||||
import type { GpuRenderMode } from './config'
|
||||
import {
|
||||
canAutoSwitchGpu,
|
||||
createVramHysteresisTracker,
|
||||
detectIntegratedGpuFromRegistryOutput,
|
||||
parseNvidiaSmiCsv,
|
||||
VRAM_LOW_THRESHOLD_MIB,
|
||||
VRAM_MONITOR_INTERVAL_MS,
|
||||
type DiscreteVramSample,
|
||||
type ResolvedGpuTarget,
|
||||
type StartupGpuDecision,
|
||||
type StartupGpuDecisionReason,
|
||||
} from './gpu-policy'
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
|
||||
const HANDOFF_RECORD_MAX_AGE_MS = 30_000
|
||||
const HANDOFF_RECORD_FILE = 'gpu-handoff.json'
|
||||
|
||||
const NVIDIA_SMI_ARGS = [
|
||||
'--query-gpu=name,memory.used,memory.free,memory.total',
|
||||
'--format=csv,noheader,nounits',
|
||||
]
|
||||
|
||||
const DISPLAY_CLASS_REG_ARGS = [
|
||||
'query',
|
||||
'HKLM\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4d36e968-e325-11ce-bfc1-08002be10318}',
|
||||
'/s',
|
||||
'/v',
|
||||
'DriverDesc',
|
||||
]
|
||||
|
||||
export interface GpuHandoffRecord {
|
||||
lastSwitchAt: number
|
||||
target: ResolvedGpuTarget
|
||||
reason: 'low-fps-low-vram' | 'vram-recovered' | 'manual'
|
||||
freeMiB?: number
|
||||
avgFps?: number
|
||||
}
|
||||
|
||||
export interface GpuRuntimeSummary {
|
||||
requestedMode: GpuRenderMode
|
||||
activeTarget: ResolvedGpuTarget
|
||||
reason: StartupGpuDecisionReason
|
||||
hasIntegratedGpu: boolean
|
||||
latestVramSample: DiscreteVramSample | null
|
||||
}
|
||||
|
||||
export interface AdaptiveGpuMonitor {
|
||||
start(): void
|
||||
stop(): void
|
||||
handleLowFpsReport(report: { avgFps: number; sustainedMs: number }): Promise<void>
|
||||
consumePendingHandoffToast(): { message: string; type: 'info' | 'success' } | null
|
||||
getRuntimeSummary(): GpuRuntimeSummary
|
||||
}
|
||||
|
||||
export function readGpuHandoffRecord(userDataDir: string): GpuHandoffRecord | null {
|
||||
if (!userDataDir) return null
|
||||
try {
|
||||
const filePath = path.join(userDataDir, HANDOFF_RECORD_FILE)
|
||||
if (!fs.existsSync(filePath)) return null
|
||||
const parsed = JSON.parse(fs.readFileSync(filePath, 'utf8')) as Partial<GpuHandoffRecord>
|
||||
if (
|
||||
!parsed ||
|
||||
typeof parsed.lastSwitchAt !== 'number' ||
|
||||
!Number.isFinite(parsed.lastSwitchAt) ||
|
||||
typeof parsed.target !== 'string' ||
|
||||
typeof parsed.reason !== 'string'
|
||||
) {
|
||||
return null
|
||||
}
|
||||
return parsed as GpuHandoffRecord
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export function writeGpuHandoffRecord(userDataDir: string, record: GpuHandoffRecord): void {
|
||||
if (!userDataDir) return
|
||||
try {
|
||||
const filePath = path.join(userDataDir, HANDOFF_RECORD_FILE)
|
||||
fs.mkdirSync(path.dirname(filePath), { recursive: true })
|
||||
fs.writeFileSync(filePath, `${JSON.stringify(record, null, 2)}\n`, 'utf8')
|
||||
} catch {
|
||||
// Ignore non-critical handoff state write failures.
|
||||
}
|
||||
}
|
||||
|
||||
export function probeWindowsGpuEnvironmentSync(): {
|
||||
vramSample: DiscreteVramSample | null
|
||||
hasIntegratedGpu: boolean
|
||||
} {
|
||||
if (process.platform !== 'win32') {
|
||||
return { vramSample: null, hasIntegratedGpu: false }
|
||||
}
|
||||
|
||||
let vramSample: DiscreteVramSample | null = null
|
||||
try {
|
||||
const out = execFileSync('nvidia-smi', NVIDIA_SMI_ARGS, {
|
||||
encoding: 'utf8',
|
||||
timeout: 800,
|
||||
windowsHide: true,
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
})
|
||||
vramSample = parseNvidiaSmiCsv(out)
|
||||
} catch {
|
||||
vramSample = null
|
||||
}
|
||||
|
||||
let hasIntegratedGpu = false
|
||||
try {
|
||||
const out = execFileSync('reg.exe', DISPLAY_CLASS_REG_ARGS, {
|
||||
encoding: 'utf8',
|
||||
timeout: 800,
|
||||
windowsHide: true,
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
})
|
||||
hasIntegratedGpu = detectIntegratedGpuFromRegistryOutput(out)
|
||||
} catch {
|
||||
hasIntegratedGpu = false
|
||||
}
|
||||
|
||||
return { vramSample, hasIntegratedGpu }
|
||||
}
|
||||
|
||||
export async function probeDiscreteVramAsync(): Promise<DiscreteVramSample | null> {
|
||||
if (process.platform !== 'win32') {
|
||||
return null
|
||||
}
|
||||
try {
|
||||
const { stdout } = await execFileAsync('nvidia-smi', NVIDIA_SMI_ARGS, {
|
||||
encoding: 'utf8',
|
||||
timeout: 2000,
|
||||
windowsHide: true,
|
||||
})
|
||||
return parseNvidiaSmiCsv(stdout)
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export async function probeIntegratedGpuAsync(): Promise<boolean> {
|
||||
if (process.platform !== 'win32') {
|
||||
return false
|
||||
}
|
||||
try {
|
||||
const { stdout } = await execFileAsync('reg.exe', DISPLAY_CLASS_REG_ARGS, {
|
||||
encoding: 'utf8',
|
||||
timeout: 2000,
|
||||
windowsHide: true,
|
||||
})
|
||||
return detectIntegratedGpuFromRegistryOutput(stdout)
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export function createAdaptiveGpuMonitor(options: {
|
||||
userDataDir: string
|
||||
startupDecision: StartupGpuDecision
|
||||
getConfiguredMode: () => GpuRenderMode
|
||||
getMainWindow: () => BrowserWindow | null
|
||||
onAutoSwitch: (target: ResolvedGpuTarget, record: GpuHandoffRecord) => void
|
||||
onStatusUpdated?: () => void
|
||||
}): AdaptiveGpuMonitor {
|
||||
let latestVramSample: DiscreteVramSample | null = options.startupDecision.vramSample
|
||||
let switching = false
|
||||
let toastConsumed = false
|
||||
let intervalTimer: ReturnType<typeof setInterval> | null = null
|
||||
const lastSwitchAt = readGpuHandoffRecord(options.userDataDir)?.lastSwitchAt ?? null
|
||||
|
||||
const activeTarget = options.startupDecision.target
|
||||
const isDiscrete = activeTarget === 'default' || activeTarget === 'high-performance'
|
||||
const isOffloaded = activeTarget === 'low-power' || activeTarget === 'software'
|
||||
|
||||
const tracker = createVramHysteresisTracker({
|
||||
activeTarget,
|
||||
hasIntegratedGpu: options.startupDecision.hasIntegratedGpu,
|
||||
})
|
||||
|
||||
const triggerAutoSwitch = (target: ResolvedGpuTarget, record: GpuHandoffRecord) => {
|
||||
if (switching) return
|
||||
switching = true
|
||||
if (intervalTimer) {
|
||||
clearInterval(intervalTimer)
|
||||
intervalTimer = null
|
||||
}
|
||||
writeGpuHandoffRecord(options.userDataDir, record)
|
||||
options.onAutoSwitch(target, record)
|
||||
}
|
||||
|
||||
const tickOffloadedRecovery = async () => {
|
||||
if (switching || !isOffloaded || options.getConfiguredMode() !== 'auto') return
|
||||
if (!canAutoSwitchGpu(lastSwitchAt, Date.now())) return
|
||||
const win = options.getMainWindow()
|
||||
if (!win || win.isDestroyed() || win.isMinimized()) return
|
||||
|
||||
const sample = await probeDiscreteVramAsync()
|
||||
latestVramSample = sample
|
||||
options.onStatusUpdated?.()
|
||||
|
||||
if (switching || options.getConfiguredMode() !== 'auto') return
|
||||
const action = tracker.observe(sample)
|
||||
if (!action || action.kind !== 'switch-to-discrete') return
|
||||
|
||||
const now = Date.now()
|
||||
if (!canAutoSwitchGpu(lastSwitchAt, now)) return
|
||||
console.info(
|
||||
`[planet-client] Discrete GPU VRAM recovered (freeMiB=${action.sample.freeMiB}); auto-switching back to discrete GPU`,
|
||||
)
|
||||
triggerAutoSwitch('default', {
|
||||
lastSwitchAt: now,
|
||||
target: 'default',
|
||||
reason: 'vram-recovered',
|
||||
freeMiB: action.sample.freeMiB,
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
start() {
|
||||
if (process.platform !== 'win32' || options.startupDecision.reason === 'headless-smoke') {
|
||||
return
|
||||
}
|
||||
if (!isOffloaded || intervalTimer) return
|
||||
intervalTimer = setInterval(() => {
|
||||
void tickOffloadedRecovery()
|
||||
}, VRAM_MONITOR_INTERVAL_MS)
|
||||
},
|
||||
|
||||
stop() {
|
||||
if (intervalTimer) {
|
||||
clearInterval(intervalTimer)
|
||||
intervalTimer = null
|
||||
}
|
||||
},
|
||||
|
||||
async handleLowFpsReport(report: { avgFps: number; sustainedMs: number }): Promise<void> {
|
||||
if (
|
||||
process.platform !== 'win32' ||
|
||||
options.startupDecision.reason === 'headless-smoke' ||
|
||||
switching ||
|
||||
!isDiscrete ||
|
||||
options.getConfiguredMode() !== 'auto'
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
const now = Date.now()
|
||||
if (!canAutoSwitchGpu(lastSwitchAt, now)) return
|
||||
|
||||
const sample = await probeDiscreteVramAsync()
|
||||
latestVramSample = sample
|
||||
options.onStatusUpdated?.()
|
||||
|
||||
if (
|
||||
switching ||
|
||||
options.getConfiguredMode() !== 'auto' ||
|
||||
!sample ||
|
||||
sample.freeMiB >= VRAM_LOW_THRESHOLD_MIB
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
const hasIgpu = options.startupDecision.hasIntegratedGpu || (await probeIntegratedGpuAsync())
|
||||
const nextTarget: ResolvedGpuTarget = hasIgpu ? 'low-power' : 'software'
|
||||
const switchNow = Date.now()
|
||||
if (!canAutoSwitchGpu(lastSwitchAt, switchNow)) return
|
||||
|
||||
console.info(
|
||||
`[planet-client] Sustained low FPS (${report.avgFps} fps for ${report.sustainedMs}ms) with low discrete VRAM (freeMiB=${sample.freeMiB}); auto-switching to ${nextTarget}`,
|
||||
)
|
||||
triggerAutoSwitch(nextTarget, {
|
||||
lastSwitchAt: switchNow,
|
||||
target: nextTarget,
|
||||
reason: 'low-fps-low-vram',
|
||||
freeMiB: sample.freeMiB,
|
||||
avgFps: report.avgFps,
|
||||
})
|
||||
},
|
||||
|
||||
consumePendingHandoffToast(): { message: string; type: 'info' | 'success' } | null {
|
||||
if (toastConsumed || options.startupDecision.reason !== 'gpu-handoff') {
|
||||
return null
|
||||
}
|
||||
toastConsumed = true
|
||||
const record = readGpuHandoffRecord(options.userDataDir)
|
||||
if (!record || Date.now() - record.lastSwitchAt >= HANDOFF_RECORD_MAX_AGE_MS) {
|
||||
return null
|
||||
}
|
||||
if (record.reason === 'low-fps-low-vram') {
|
||||
return record.target === 'software'
|
||||
? { message: '独显显存不足且帧率偏低,已自动切换至 CPU 软渲染', type: 'info' }
|
||||
: {
|
||||
message: '独显显存不足且帧率偏低,已自动切换至集成核显渲染(保留全部特效)',
|
||||
type: 'info',
|
||||
}
|
||||
}
|
||||
if (record.reason === 'vram-recovered') {
|
||||
return { message: '独显显存已充足,已自动切回独立显卡渲染', type: 'success' }
|
||||
}
|
||||
return null
|
||||
},
|
||||
|
||||
getRuntimeSummary(): GpuRuntimeSummary {
|
||||
return {
|
||||
requestedMode: options.getConfiguredMode(),
|
||||
activeTarget: options.startupDecision.target,
|
||||
reason: options.startupDecision.reason,
|
||||
hasIntegratedGpu: options.startupDecision.hasIntegratedGpu,
|
||||
latestVramSample,
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,168 @@
|
||||
import type { GpuRenderMode } from './config'
|
||||
|
||||
export const VRAM_LOW_THRESHOLD_MIB = 2048
|
||||
export const VRAM_RECOVER_THRESHOLD_MIB = 3584
|
||||
export const VRAM_MONITOR_INTERVAL_MS = 5_000
|
||||
export const VRAM_SWITCH_CONSECUTIVE_REQUIRED = 2
|
||||
export const LOW_FPS_THRESHOLD = 20
|
||||
export const LOW_FPS_SUSTAINED_MS = 5_000
|
||||
export const FPS_STARTUP_WARMUP_MS = 6_000
|
||||
export const FPS_REPORT_COOLDOWN_MS = 15_000
|
||||
export const AUTO_SWITCH_COOLDOWN_MS = 45_000
|
||||
|
||||
export interface ChromiumSwitch {
|
||||
name: string
|
||||
value?: string
|
||||
}
|
||||
|
||||
export type ResolvedGpuTarget = 'default' | 'high-performance' | 'low-power' | 'software'
|
||||
|
||||
export interface DiscreteVramSample {
|
||||
gpuName: string
|
||||
usedMiB: number
|
||||
freeMiB: number
|
||||
totalMiB: number
|
||||
}
|
||||
|
||||
export type StartupGpuDecisionReason =
|
||||
| 'headless-smoke'
|
||||
| 'gpu-handoff'
|
||||
| 'user-software'
|
||||
| 'user-low-power'
|
||||
| 'user-high-performance'
|
||||
| 'low-vram-igpu'
|
||||
| 'low-vram-software'
|
||||
| 'normal-gpu'
|
||||
|
||||
export interface StartupGpuDecision {
|
||||
target: ResolvedGpuTarget
|
||||
requestedMode: GpuRenderMode
|
||||
reason: StartupGpuDecisionReason
|
||||
vramSample: DiscreteVramSample | null
|
||||
hasIntegratedGpu: boolean
|
||||
}
|
||||
|
||||
export interface VramMonitorAction {
|
||||
kind: 'switch-to-discrete' | 'switch-to-low-power' | 'switch-to-software'
|
||||
sample: DiscreteVramSample
|
||||
}
|
||||
|
||||
export interface GpuPolicyInput {
|
||||
platform: NodeJS.Platform
|
||||
headlessSmoke: boolean
|
||||
softwareGl: boolean
|
||||
softwareGl?: boolean
|
||||
target?: ResolvedGpuTarget
|
||||
}
|
||||
|
||||
const VIRTUAL_DISPLAY_ADAPTER_RE = /microsoft basic|remote display|parsec|virtual|indirect|mirage/i
|
||||
const INTEL_ADAPTER_RE = /\bintel\b/i
|
||||
const INTEL_DISCRETE_ARC_RE = /\barc\b.*\b[ab]\d{3}\b/i
|
||||
const AMD_INTEGRATED_RE = /\bamd\s+radeon(?:\(tm\))?\s+(?:graphics|\d+m\b|vega\s+\d+\s+graphics)/i
|
||||
|
||||
function parseMiBField(raw: string | undefined): number | null {
|
||||
if (!raw) return null
|
||||
const trimmed = raw.trim()
|
||||
if (!trimmed || /n\/a/i.test(trimmed)) return null
|
||||
const cleaned = trimmed.replace(/\s*mib$/i, '')
|
||||
if (!/^\d+(?:\.\d+)?$/.test(cleaned)) return null
|
||||
const num = Number(cleaned)
|
||||
return Number.isFinite(num) ? num : null
|
||||
}
|
||||
|
||||
export function parseNvidiaSmiCsv(stdout: string): DiscreteVramSample | null {
|
||||
if (!stdout) return null
|
||||
for (const rawLine of stdout.split(/\r?\n/)) {
|
||||
const line = rawLine.trim()
|
||||
if (!line) continue
|
||||
const parts = line.split(',')
|
||||
if (parts.length < 4) continue
|
||||
const gpuName = parts.slice(0, -3).join(',').trim()
|
||||
const usedMiB = parseMiBField(parts[parts.length - 3])
|
||||
const freeMiB = parseMiBField(parts[parts.length - 2])
|
||||
const totalMiB = parseMiBField(parts[parts.length - 1])
|
||||
if (
|
||||
!gpuName ||
|
||||
usedMiB === null ||
|
||||
freeMiB === null ||
|
||||
totalMiB === null ||
|
||||
usedMiB < 0 ||
|
||||
freeMiB < 0 ||
|
||||
totalMiB <= 0
|
||||
) {
|
||||
continue
|
||||
}
|
||||
return { gpuName, usedMiB, freeMiB, totalMiB }
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
export function detectIntegratedGpuFromRegistryOutput(stdout: string): boolean {
|
||||
if (!stdout) return false
|
||||
for (const rawLine of stdout.split(/\r?\n/)) {
|
||||
const match = /^\s*DriverDesc\s+REG_SZ\s+(.+?)\s*$/i.exec(rawLine)
|
||||
if (!match) continue
|
||||
const desc = match[1].trim()
|
||||
if (!desc || VIRTUAL_DISPLAY_ADAPTER_RE.test(desc)) continue
|
||||
if (INTEL_ADAPTER_RE.test(desc) && !INTEL_DISCRETE_ARC_RE.test(desc)) {
|
||||
return true
|
||||
}
|
||||
if (AMD_INTEGRATED_RE.test(desc)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
export function chooseStartupGpuTarget(input: {
|
||||
platform: NodeJS.Platform
|
||||
headlessSmoke: boolean
|
||||
requestedMode: GpuRenderMode
|
||||
handoffTarget?: ResolvedGpuTarget
|
||||
vramSample: DiscreteVramSample | null
|
||||
hasIntegratedGpu: boolean
|
||||
}): StartupGpuDecision {
|
||||
const base = {
|
||||
requestedMode: input.requestedMode,
|
||||
vramSample: input.vramSample,
|
||||
hasIntegratedGpu: input.hasIntegratedGpu,
|
||||
}
|
||||
|
||||
if (input.headlessSmoke) {
|
||||
return { ...base, target: 'software', reason: 'headless-smoke' }
|
||||
}
|
||||
if (input.requestedMode === 'software') {
|
||||
return { ...base, target: 'software', reason: 'user-software' }
|
||||
}
|
||||
if (input.requestedMode === 'low-power') {
|
||||
return { ...base, target: 'low-power', reason: 'user-low-power' }
|
||||
}
|
||||
if (input.requestedMode === 'high-performance') {
|
||||
return { ...base, target: 'high-performance', reason: 'user-high-performance' }
|
||||
}
|
||||
if (input.handoffTarget) {
|
||||
return { ...base, target: input.handoffTarget, reason: 'gpu-handoff' }
|
||||
}
|
||||
|
||||
if (
|
||||
input.platform === 'win32' &&
|
||||
input.vramSample &&
|
||||
input.vramSample.freeMiB < VRAM_LOW_THRESHOLD_MIB
|
||||
) {
|
||||
return input.hasIntegratedGpu
|
||||
? { ...base, target: 'low-power', reason: 'low-vram-igpu' }
|
||||
: { ...base, target: 'software', reason: 'low-vram-software' }
|
||||
}
|
||||
|
||||
return { ...base, target: 'default', reason: 'normal-gpu' }
|
||||
}
|
||||
|
||||
export function resolveChromiumGpuSwitches(input: GpuPolicyInput): ChromiumSwitch[] {
|
||||
if (input.headlessSmoke || input.softwareGl) {
|
||||
const effectiveTarget: ResolvedGpuTarget =
|
||||
input.headlessSmoke || input.softwareGl || input.target === 'software'
|
||||
? 'software'
|
||||
: (input.target ?? 'default')
|
||||
|
||||
if (effectiveTarget === 'software') {
|
||||
return [
|
||||
{ name: 'disable-gpu' },
|
||||
{ name: 'use-gl', value: 'angle' },
|
||||
@@ -19,15 +171,175 @@ export function resolveChromiumGpuSwitches(input: GpuPolicyInput): ChromiumSwitc
|
||||
]
|
||||
}
|
||||
|
||||
// Avoid forcing enable-zero-copy / enable-gpu-rasterization / force_high_performance_gpu:
|
||||
// Avoid forcing enable-zero-copy / enable-gpu-rasterization:
|
||||
// on Windows dual-GPU setups with high baseline VRAM usage they can provoke driver TDRs.
|
||||
const switches: ChromiumSwitch[] = [{ name: 'disable-renderer-backgrounding' }]
|
||||
const switches: ChromiumSwitch[] = []
|
||||
if (effectiveTarget === 'low-power') {
|
||||
switches.push({ name: 'force_low_power_gpu' })
|
||||
} else if (effectiveTarget === 'high-performance') {
|
||||
switches.push({ name: 'force_high_performance_gpu' })
|
||||
}
|
||||
switches.push({ name: 'disable-renderer-backgrounding' })
|
||||
if (input.platform === 'linux') {
|
||||
switches.push({ name: 'ozone-platform-hint', value: 'auto' })
|
||||
}
|
||||
return switches
|
||||
}
|
||||
|
||||
export function createVramHysteresisTracker(options: {
|
||||
activeTarget: ResolvedGpuTarget
|
||||
hasIntegratedGpu: boolean
|
||||
lowThresholdMiB?: number
|
||||
recoverThresholdMiB?: number
|
||||
requiredConsecutive?: number
|
||||
}) {
|
||||
const lowThresholdMiB = options.lowThresholdMiB ?? VRAM_LOW_THRESHOLD_MIB
|
||||
const recoverThresholdMiB = options.recoverThresholdMiB ?? VRAM_RECOVER_THRESHOLD_MIB
|
||||
const requiredConsecutive = Math.max(1, options.requiredConsecutive ?? VRAM_SWITCH_CONSECUTIVE_REQUIRED)
|
||||
let streak = 0
|
||||
|
||||
return {
|
||||
observe(sample: DiscreteVramSample | null): VramMonitorAction | null {
|
||||
if (!sample) {
|
||||
streak = 0
|
||||
return null
|
||||
}
|
||||
|
||||
if (options.activeTarget === 'low-power' || options.activeTarget === 'software') {
|
||||
if (sample.freeMiB >= recoverThresholdMiB) {
|
||||
streak += 1
|
||||
if (streak >= requiredConsecutive) {
|
||||
return { kind: 'switch-to-discrete', sample }
|
||||
}
|
||||
} else {
|
||||
streak = 0
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
if (sample.freeMiB < lowThresholdMiB) {
|
||||
streak += 1
|
||||
if (streak >= requiredConsecutive) {
|
||||
return {
|
||||
kind: options.hasIntegratedGpu ? 'switch-to-low-power' : 'switch-to-software',
|
||||
sample,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
streak = 0
|
||||
}
|
||||
return null
|
||||
},
|
||||
reset(): void {
|
||||
streak = 0
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export function createSustainedLowFpsTracker(
|
||||
options: {
|
||||
thresholdFps?: number
|
||||
sustainedMs?: number
|
||||
sampleWindowMs?: number
|
||||
reportCooldownMs?: number
|
||||
} = {},
|
||||
) {
|
||||
const thresholdFps = options.thresholdFps ?? LOW_FPS_THRESHOLD
|
||||
const sustainedMs = options.sustainedMs ?? LOW_FPS_SUSTAINED_MS
|
||||
const sampleWindowMs = options.sampleWindowMs ?? 1000
|
||||
const reportCooldownMs = options.reportCooldownMs ?? FPS_REPORT_COOLDOWN_MS
|
||||
|
||||
let bucketStartMs: number | null = null
|
||||
let bucketFrames = 0
|
||||
let lowDurationMs = 0
|
||||
let lowFrames = 0
|
||||
let lastReportedAt = -Infinity
|
||||
|
||||
return {
|
||||
onFrame(nowMs: number): { avgFps: number; sustainedMs: number } | null {
|
||||
if (!Number.isFinite(nowMs)) return null
|
||||
if (bucketStartMs === null) {
|
||||
bucketStartMs = nowMs
|
||||
bucketFrames = 0
|
||||
return null
|
||||
}
|
||||
bucketFrames += 1
|
||||
const elapsedMs = nowMs - bucketStartMs
|
||||
if (elapsedMs < sampleWindowMs) {
|
||||
return null
|
||||
}
|
||||
|
||||
const fps = (bucketFrames * 1000) / elapsedMs
|
||||
bucketStartMs = nowMs
|
||||
|
||||
if (fps < thresholdFps) {
|
||||
lowDurationMs += elapsedMs
|
||||
lowFrames += bucketFrames
|
||||
bucketFrames = 0
|
||||
if (lowDurationMs >= sustainedMs && nowMs - lastReportedAt >= reportCooldownMs) {
|
||||
const avgFps = Math.round(((lowFrames * 1000) / lowDurationMs) * 10) / 10
|
||||
const reportedDuration = Math.round(lowDurationMs)
|
||||
lastReportedAt = nowMs
|
||||
lowDurationMs = 0
|
||||
lowFrames = 0
|
||||
return { avgFps, sustainedMs: reportedDuration }
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
bucketFrames = 0
|
||||
lowDurationMs = 0
|
||||
lowFrames = 0
|
||||
return null
|
||||
},
|
||||
reset(): void {
|
||||
bucketStartMs = null
|
||||
bucketFrames = 0
|
||||
lowDurationMs = 0
|
||||
lowFrames = 0
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export function canAutoSwitchGpu(
|
||||
lastSwitchAt: number | null | undefined,
|
||||
nowMs: number,
|
||||
cooldownMs = AUTO_SWITCH_COOLDOWN_MS,
|
||||
): boolean {
|
||||
return !lastSwitchAt || !Number.isFinite(lastSwitchAt) || nowMs - lastSwitchAt >= cooldownMs
|
||||
}
|
||||
|
||||
export function stripGpuOverrideArgs(argv: string[]): string[] {
|
||||
const stripped: string[] = []
|
||||
for (let i = 0; i < argv.length; i += 1) {
|
||||
const arg = argv[i]
|
||||
if (
|
||||
arg === '--software-gl' ||
|
||||
arg === '--low-power-gpu' ||
|
||||
arg === '--high-performance-gpu' ||
|
||||
arg === '--gpu-handoff' ||
|
||||
arg.startsWith('--gpu-mode=') ||
|
||||
arg.startsWith('--gpu-handoff-target=')
|
||||
) {
|
||||
continue
|
||||
}
|
||||
if (arg === '--gpu-mode' || arg === '--gpu-handoff-target') {
|
||||
i += 1
|
||||
continue
|
||||
}
|
||||
stripped.push(arg)
|
||||
}
|
||||
return stripped
|
||||
}
|
||||
|
||||
export function buildGpuHandoffArgs(argv: string[], target?: ResolvedGpuTarget): string[] {
|
||||
return [
|
||||
...stripGpuOverrideArgs(argv),
|
||||
'--gpu-handoff',
|
||||
...(target ? [`--gpu-handoff-target=${target}`] : []),
|
||||
]
|
||||
}
|
||||
|
||||
export function isGpuProcessCrash(
|
||||
details: { type?: string; reason?: string } | null | undefined,
|
||||
): boolean {
|
||||
|
||||
+127
-7
@@ -1,25 +1,68 @@
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
||||
import { app, BrowserWindow, ipcMain, Menu, session, shell } from 'electron'
|
||||
import { app, BrowserWindow, dialog, ipcMain, Menu, session, shell } from 'electron'
|
||||
|
||||
import { DesktopConfigStore, normalizeSplashTheme, type ServerEndpoints } from './config'
|
||||
import { DesktopConfigStore, normalizeSplashTheme, readPreReadyGpuHandoff, readPreReadyGpuMode, type GpuRenderMode, type ServerEndpoints } from './config'
|
||||
import { DESKTOP_SCHEME, registerDesktopLink } from './desktop-link'
|
||||
import { isGpuProcessCrash, resolveChromiumGpuSwitches } from './gpu-policy'
|
||||
import { createAdaptiveGpuMonitor, probeWindowsGpuEnvironmentSync } from './gpu-monitor'
|
||||
import { buildGpuHandoffArgs, chooseStartupGpuTarget, isGpuProcessCrash, resolveChromiumGpuSwitches, stripGpuOverrideArgs, type ResolvedGpuTarget } from './gpu-policy'
|
||||
import { PERIODIC_UPDATE_CHECK_INTERVAL_MS } from './hot-update-core'
|
||||
import { createHotUpdateController } from './hot-updater'
|
||||
import { buildApplicationMenu } from './menu'
|
||||
import { EARTH_ORIGIN, installEarthSessionHandlers, registerEarthScheme } from './protocol'
|
||||
import { createMainWindow, dismissMenuBarOnPointerDown, toggleWindowOrientation } from './window'
|
||||
import { createMainWindow, dismissMenuBarOnPointerDown, flushWindowState, toggleWindowOrientation } from './window'
|
||||
|
||||
registerEarthScheme()
|
||||
|
||||
const isHeadlessSmoke = process.argv.includes('--headless-smoke')
|
||||
const isSoftwareGl = process.argv.includes('--software-gl')
|
||||
let preReadyUserDataDir = ''
|
||||
let preReadyExeDir = process.cwd()
|
||||
try {
|
||||
preReadyUserDataDir = app.getPath('userData')
|
||||
} catch {
|
||||
preReadyUserDataDir = ''
|
||||
}
|
||||
try {
|
||||
preReadyExeDir = path.dirname(app.getPath('exe'))
|
||||
} catch {
|
||||
preReadyExeDir = process.cwd()
|
||||
}
|
||||
|
||||
const requestedGpuMode = readPreReadyGpuMode({
|
||||
userDataDir: preReadyUserDataDir,
|
||||
exeDir: preReadyExeDir,
|
||||
resourcesDir: process.resourcesPath,
|
||||
argv: process.argv,
|
||||
})
|
||||
const preReadyHandoff = readPreReadyGpuHandoff(process.argv)
|
||||
const preReadyGpuEnv =
|
||||
!isHeadlessSmoke &&
|
||||
!preReadyHandoff.gpuHandoffTarget &&
|
||||
requestedGpuMode === 'auto' &&
|
||||
process.platform === 'win32'
|
||||
? probeWindowsGpuEnvironmentSync()
|
||||
: { vramSample: null, hasIntegratedGpu: false }
|
||||
|
||||
const startupGpuDecision = chooseStartupGpuTarget({
|
||||
platform: process.platform,
|
||||
headlessSmoke: isHeadlessSmoke,
|
||||
requestedMode: requestedGpuMode,
|
||||
handoffTarget: preReadyHandoff.gpuHandoffTarget,
|
||||
vramSample: preReadyGpuEnv.vramSample,
|
||||
hasIntegratedGpu: preReadyGpuEnv.hasIntegratedGpu,
|
||||
})
|
||||
|
||||
if (startupGpuDecision.reason === 'low-vram-igpu' || startupGpuDecision.reason === 'low-vram-software') {
|
||||
console.info(
|
||||
`[planet-client] Adaptive GPU selected ${startupGpuDecision.target} (reason=${startupGpuDecision.reason}, freeMiB=${startupGpuDecision.vramSample?.freeMiB ?? 'unknown'})`,
|
||||
)
|
||||
}
|
||||
|
||||
for (const sw of resolveChromiumGpuSwitches({
|
||||
platform: process.platform,
|
||||
headlessSmoke: isHeadlessSmoke,
|
||||
softwareGl: isSoftwareGl,
|
||||
target: startupGpuDecision.target,
|
||||
})) {
|
||||
if (sw.value !== undefined) {
|
||||
app.commandLine.appendSwitch(sw.name, sw.value)
|
||||
@@ -119,6 +162,22 @@ if (!singleInstanceLock) {
|
||||
})
|
||||
|
||||
const earthBundleRoot = resolveEarthBundleRoot()
|
||||
const relaunchDesktopApp = (relaunchOptions?: {
|
||||
gpuHandoff?: boolean
|
||||
gpuHandoffTarget?: ResolvedGpuTarget
|
||||
}) => {
|
||||
flushWindowState(mainWindow)
|
||||
if (singleInstanceLock) {
|
||||
app.releaseSingleInstanceLock()
|
||||
}
|
||||
const rawArgs = process.argv.slice(1)
|
||||
const args = relaunchOptions?.gpuHandoff
|
||||
? buildGpuHandoffArgs(rawArgs, relaunchOptions.gpuHandoffTarget)
|
||||
: stripGpuOverrideArgs(rawArgs)
|
||||
app.relaunch({ args })
|
||||
app.exit(0)
|
||||
}
|
||||
|
||||
const hotUpdater = createHotUpdateController({
|
||||
userDataDir: app.getPath('userData'),
|
||||
shellVersion: app.getVersion(),
|
||||
@@ -129,6 +188,29 @@ if (!singleInstanceLock) {
|
||||
},
|
||||
})
|
||||
|
||||
const gpuMonitor = createAdaptiveGpuMonitor({
|
||||
userDataDir: app.getPath('userData'),
|
||||
startupDecision: startupGpuDecision,
|
||||
getConfiguredMode: () => configStore.get().gpuMode,
|
||||
getMainWindow: () => mainWindow,
|
||||
onAutoSwitch: (nextTarget) => {
|
||||
relaunchDesktopApp({ gpuHandoff: true, gpuHandoffTarget: nextTarget })
|
||||
},
|
||||
onStatusUpdated: () => {
|
||||
refreshApplicationMenu()
|
||||
},
|
||||
})
|
||||
|
||||
const sendPendingHandoffToast = () => {
|
||||
if (isHeadlessSmoke || !mainWindow || mainWindow.isDestroyed() || mainWindow.webContents.isDestroyed()) {
|
||||
return
|
||||
}
|
||||
const toast = gpuMonitor.consumePendingHandoffToast()
|
||||
if (toast) {
|
||||
mainWindow.webContents.send('planet:update-status', toast)
|
||||
}
|
||||
}
|
||||
|
||||
const refreshApplicationMenu = () => {
|
||||
if (!mainWindow || mainWindow.isDestroyed()) return
|
||||
Menu.setApplicationMenu(
|
||||
@@ -139,6 +221,27 @@ if (!singleInstanceLock) {
|
||||
onCheckForUpdates: () => {
|
||||
void hotUpdater.checkForUpdates({ manual: true })
|
||||
},
|
||||
getGpuStatus: () => gpuMonitor.getRuntimeSummary(),
|
||||
onSelectGpuMode: async (nextMode: GpuRenderMode) => {
|
||||
configStore.updateGpuMode(nextMode)
|
||||
refreshApplicationMenu()
|
||||
const targetWin = mainWindow && !mainWindow.isDestroyed() ? mainWindow : undefined
|
||||
const boxOptions = {
|
||||
type: 'info' as const,
|
||||
title: '渲染设备设置 / GPU Mode',
|
||||
message: '渲染设备模式已更新,需重启客户端生效',
|
||||
detail: '是否立即重启 Planet Earth?(重启约需 1-2 秒,将保留全部视觉特效)',
|
||||
buttons: ['立即重启 / Restart Now', '稍后手动重启 / Later'],
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
}
|
||||
const { response } = targetWin
|
||||
? await dialog.showMessageBox(targetWin, boxOptions)
|
||||
: await dialog.showMessageBox(boxOptions)
|
||||
if (response === 0) {
|
||||
relaunchDesktopApp({ gpuHandoff: true })
|
||||
}
|
||||
},
|
||||
}),
|
||||
)
|
||||
}
|
||||
@@ -152,9 +255,21 @@ if (!singleInstanceLock) {
|
||||
ipcMain.on('planet:earth-startup-ready', () => {
|
||||
if (!isHeadlessSmoke) {
|
||||
hotUpdater.markStartupReady()
|
||||
sendPendingHandoffToast()
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.on('planet:low-fps-report', (_event, payload: unknown) => {
|
||||
if (isHeadlessSmoke || !payload || typeof payload !== 'object') return
|
||||
const candidate = payload as { avgFps?: unknown; sustainedMs?: unknown }
|
||||
const avgFps = Number(candidate.avgFps)
|
||||
const sustainedMs = Number(candidate.sustainedMs)
|
||||
if (!Number.isFinite(avgFps) || avgFps <= 0 || !Number.isFinite(sustainedMs) || sustainedMs <= 0) {
|
||||
return
|
||||
}
|
||||
void gpuMonitor.handleLowFpsReport({ avgFps, sustainedMs })
|
||||
})
|
||||
|
||||
ipcMain.handle('planet:check-for-updates', async () => {
|
||||
await hotUpdater.checkForUpdates({ manual: true })
|
||||
})
|
||||
@@ -170,6 +285,9 @@ if (!singleInstanceLock) {
|
||||
wsUrl: cfg.wsUrl,
|
||||
forceShowFps: cfg.forceShowFps,
|
||||
splashTheme: cfg.splashTheme,
|
||||
gpuMode: cfg.gpuMode,
|
||||
gpuTarget: startupGpuDecision.target,
|
||||
gpuHandoff: cfg.gpuHandoff,
|
||||
headlessSmoke: cfg.headlessSmoke,
|
||||
isElectron: true,
|
||||
platform: process.platform,
|
||||
@@ -259,6 +377,7 @@ if (!singleInstanceLock) {
|
||||
})
|
||||
hotUpdater.startStartupWatchdog()
|
||||
mainWindow.webContents.once('did-finish-load', () => {
|
||||
gpuMonitor.start()
|
||||
autoUpdateTimer = setTimeout(() => {
|
||||
autoUpdateTimer = null
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
@@ -274,6 +393,7 @@ if (!singleInstanceLock) {
|
||||
}
|
||||
})
|
||||
mainWindow.once('closed', () => {
|
||||
gpuMonitor.stop()
|
||||
if (autoUpdateTimer) {
|
||||
clearTimeout(autoUpdateTimer)
|
||||
autoUpdateTimer = null
|
||||
@@ -358,7 +478,7 @@ if (!singleInstanceLock) {
|
||||
mounted: Boolean(host && sr),
|
||||
hasPresentedBy: copy.includes('PRESENTED BY'),
|
||||
hasPresenterZh: copy.includes('临空智能媒体研究院'),
|
||||
hasPresenterEn: copy.includes('Institute of Intelligent Media'),
|
||||
hasPresenterEn: copy.includes('Intelligent Media Institute'),
|
||||
emblemLoaded: Boolean(img && img.complete && img.naturalWidth > 0),
|
||||
emblemWidth: img ? img.naturalWidth : 0,
|
||||
activeTheme,
|
||||
|
||||
+68
-2
@@ -1,15 +1,33 @@
|
||||
import { app, Menu, shell, type BrowserWindow, type MenuItemConstructorOptions } from 'electron'
|
||||
|
||||
import type { DesktopConfigStore, SplashTheme } from './config'
|
||||
import type { DesktopConfigStore, GpuRenderMode, SplashTheme } from './config'
|
||||
import type { GpuRuntimeSummary } from './gpu-monitor'
|
||||
import type { HotUpdateVersionInfo } from './hot-updater'
|
||||
import { openServerSettingsDialog, toggleWindowOrientation } from './window'
|
||||
|
||||
import type { HotUpdateVersionInfo } from './hot-updater'
|
||||
function formatGpuSummaryLabel(summary: GpuRuntimeSummary): string {
|
||||
const targetLabel =
|
||||
summary.activeTarget === 'low-power'
|
||||
? '集成核显'
|
||||
: summary.activeTarget === 'software'
|
||||
? 'CPU 软渲染'
|
||||
: summary.activeTarget === 'high-performance' || summary.latestVramSample
|
||||
? '独立显卡'
|
||||
: '硬件 GPU'
|
||||
const modeTag = summary.requestedMode === 'auto' ? '自动' : '手动'
|
||||
const vramTag = summary.latestVramSample
|
||||
? ` · 独显空闲 ${(summary.latestVramSample.freeMiB / 1024).toFixed(1)} GB`
|
||||
: ''
|
||||
return `当前生效: ${targetLabel} (${modeTag}${vramTag})`
|
||||
}
|
||||
|
||||
export function buildApplicationMenu(options: {
|
||||
mainWindow: BrowserWindow
|
||||
configStore: DesktopConfigStore
|
||||
getVersionInfo?: () => HotUpdateVersionInfo
|
||||
onCheckForUpdates?: () => void
|
||||
getGpuStatus?: () => GpuRuntimeSummary
|
||||
onSelectGpuMode?: (mode: GpuRenderMode) => void | Promise<void>
|
||||
}): Menu {
|
||||
const sendAction = (action: string) => {
|
||||
if (!options.mainWindow.isDestroyed()) {
|
||||
@@ -23,6 +41,8 @@ export function buildApplicationMenu(options: {
|
||||
}
|
||||
|
||||
const currentSplashTheme = options.configStore.get().splashTheme
|
||||
const currentGpuMode = options.configStore.get().gpuMode
|
||||
const gpuSummary = options.getGpuStatus?.()
|
||||
|
||||
const selectSplashTheme = (theme: SplashTheme) => {
|
||||
options.configStore.updateSplashTheme(theme)
|
||||
@@ -92,6 +112,52 @@ export function buildApplicationMenu(options: {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '渲染设备 / GPU Mode',
|
||||
submenu: [
|
||||
...(gpuSummary
|
||||
? [
|
||||
{
|
||||
label: formatGpuSummaryLabel(gpuSummary),
|
||||
enabled: false,
|
||||
},
|
||||
{ type: 'separator' as const },
|
||||
]
|
||||
: []),
|
||||
{
|
||||
label: '自动(卡顿缺显存切核显,显存空出自动回独显) / Auto',
|
||||
type: 'radio',
|
||||
checked: currentGpuMode === 'auto',
|
||||
click: () => {
|
||||
void options.onSelectGpuMode?.('auto')
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '独立显卡(高性能) / Discrete GPU',
|
||||
type: 'radio',
|
||||
checked: currentGpuMode === 'high-performance',
|
||||
click: () => {
|
||||
void options.onSelectGpuMode?.('high-performance')
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '集成核显(不占独显显存) / Integrated GPU',
|
||||
type: 'radio',
|
||||
checked: currentGpuMode === 'low-power',
|
||||
click: () => {
|
||||
void options.onSelectGpuMode?.('low-power')
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '纯 CPU 软渲染 / Software GL',
|
||||
type: 'radio',
|
||||
checked: currentGpuMode === 'software',
|
||||
click: () => {
|
||||
void options.onSelectGpuMode?.('software')
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: '打开运维控制台 / Open Admin Console',
|
||||
|
||||
@@ -21,6 +21,12 @@ import {
|
||||
import { EARTH_ENTRY_URL, EARTH_ORIGIN } from './protocol'
|
||||
|
||||
const resetAltMenuTrackers = new WeakMap<BrowserWindow, () => void>()
|
||||
const windowStateFlushers = new WeakMap<BrowserWindow, () => void>()
|
||||
|
||||
export function flushWindowState(win: BrowserWindow | null): void {
|
||||
if (!win || win.isDestroyed()) return
|
||||
windowStateFlushers.get(win)?.()
|
||||
}
|
||||
|
||||
interface OrientationWindowState {
|
||||
lastLandscapeBounds: Rect | null
|
||||
@@ -296,14 +302,17 @@ export function createMainWindow(options: {
|
||||
}
|
||||
}
|
||||
|
||||
win.on('resize', captureNormalBounds)
|
||||
win.on('move', captureNormalBounds)
|
||||
win.on('close', () => {
|
||||
const flushCurrentWindowState = () => {
|
||||
captureNormalBounds()
|
||||
if (!runtimeConfig.headlessSmoke) {
|
||||
saveWindowState(statePath, win, lastNormalBounds)
|
||||
}
|
||||
})
|
||||
}
|
||||
windowStateFlushers.set(win, flushCurrentWindowState)
|
||||
|
||||
win.on('resize', captureNormalBounds)
|
||||
win.on('move', captureNormalBounds)
|
||||
win.on('close', flushCurrentWindowState)
|
||||
|
||||
win.on('minimize', () => {
|
||||
if (!win.isDestroyed()) {
|
||||
@@ -346,7 +355,10 @@ export function createMainWindow(options: {
|
||||
}
|
||||
|
||||
const showGate = createWindowShowGate({
|
||||
requireSplashFirstPaint: !runtimeConfig.headlessSmoke && runtimeConfig.splashTheme !== 'off',
|
||||
requireSplashFirstPaint:
|
||||
!runtimeConfig.headlessSmoke &&
|
||||
!runtimeConfig.gpuHandoff &&
|
||||
runtimeConfig.splashTheme !== 'off',
|
||||
fallbackDelayMs: 1500,
|
||||
onReveal: revealMainWindow,
|
||||
})
|
||||
@@ -359,6 +371,7 @@ export function createMainWindow(options: {
|
||||
ipcMain.on('planet:splash-first-paint', onSplashFirstPaint)
|
||||
|
||||
win.once('closed', () => {
|
||||
windowStateFlushers.delete(win)
|
||||
showGate.dispose()
|
||||
ipcMain.removeListener('planet:splash-first-paint', onSplashFirstPaint)
|
||||
})
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
import {
|
||||
createSustainedLowFpsTracker,
|
||||
FPS_STARTUP_WARMUP_MS,
|
||||
} from '../main/gpu-policy'
|
||||
|
||||
export function startDesktopLowFpsWatcher(options: {
|
||||
onLowFps: (report: { avgFps: number; sustainedMs: number }) => void
|
||||
}): () => void {
|
||||
const tracker = createSustainedLowFpsTracker()
|
||||
let disposed = false
|
||||
let rafId = 0
|
||||
let warmupTimer: ReturnType<typeof setTimeout> | null = null
|
||||
let startupReady = document.documentElement?.dataset?.earthStartupReady === '1'
|
||||
let warmupDone = false
|
||||
let desktopMinimized = false
|
||||
|
||||
const isActive = () =>
|
||||
!disposed && startupReady && warmupDone && !desktopMinimized && !document.hidden
|
||||
|
||||
const stopLoop = () => {
|
||||
if (rafId) {
|
||||
cancelAnimationFrame(rafId)
|
||||
rafId = 0
|
||||
}
|
||||
tracker.reset()
|
||||
}
|
||||
|
||||
const tick = (now: number) => {
|
||||
if (!isActive()) {
|
||||
rafId = 0
|
||||
tracker.reset()
|
||||
return
|
||||
}
|
||||
const report = tracker.onFrame(now)
|
||||
if (report) {
|
||||
options.onLowFps(report)
|
||||
}
|
||||
rafId = requestAnimationFrame(tick)
|
||||
}
|
||||
|
||||
const syncLoop = () => {
|
||||
if (!isActive()) {
|
||||
stopLoop()
|
||||
return
|
||||
}
|
||||
if (!rafId) {
|
||||
rafId = requestAnimationFrame(tick)
|
||||
}
|
||||
}
|
||||
|
||||
const beginWarmup = () => {
|
||||
if (disposed || warmupDone || warmupTimer) return
|
||||
warmupTimer = setTimeout(() => {
|
||||
warmupTimer = null
|
||||
warmupDone = true
|
||||
syncLoop()
|
||||
}, FPS_STARTUP_WARMUP_MS)
|
||||
}
|
||||
|
||||
const onStartupReady = () => {
|
||||
startupReady = true
|
||||
beginWarmup()
|
||||
}
|
||||
|
||||
const onVisibilityChange = () => {
|
||||
syncLoop()
|
||||
}
|
||||
|
||||
const onDesktopVisibility = (event: Event) => {
|
||||
const detail = (event as CustomEvent<{ minimized?: boolean }>).detail
|
||||
desktopMinimized = Boolean(detail?.minimized)
|
||||
syncLoop()
|
||||
}
|
||||
|
||||
if (startupReady) {
|
||||
beginWarmup()
|
||||
} else {
|
||||
window.addEventListener('earth:startup-ready', onStartupReady, { once: true })
|
||||
}
|
||||
document.addEventListener('visibilitychange', onVisibilityChange)
|
||||
window.addEventListener('planet-desktop:visibility', onDesktopVisibility)
|
||||
|
||||
return () => {
|
||||
disposed = true
|
||||
stopLoop()
|
||||
if (warmupTimer) {
|
||||
clearTimeout(warmupTimer)
|
||||
warmupTimer = null
|
||||
}
|
||||
window.removeEventListener('earth:startup-ready', onStartupReady)
|
||||
document.removeEventListener('visibilitychange', onVisibilityChange)
|
||||
window.removeEventListener('planet-desktop:visibility', onDesktopVisibility)
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { contextBridge, ipcRenderer } from 'electron'
|
||||
|
||||
import { startDesktopLowFpsWatcher } from './fps-watcher'
|
||||
import { createDesktopSplashController, type SplashTheme } from './splash'
|
||||
|
||||
interface PreloadRuntimeConfig {
|
||||
@@ -9,6 +10,9 @@ interface PreloadRuntimeConfig {
|
||||
wsUrl: string
|
||||
forceShowFps: boolean
|
||||
splashTheme: SplashTheme
|
||||
gpuMode?: string
|
||||
gpuTarget?: string
|
||||
gpuHandoff?: boolean
|
||||
headlessSmoke: boolean
|
||||
isElectron: true
|
||||
platform: string
|
||||
@@ -27,7 +31,7 @@ const splashController = createDesktopSplashController({
|
||||
},
|
||||
})
|
||||
|
||||
if (!runtimeConfig.headlessSmoke && runtimeConfig.splashTheme !== 'off') {
|
||||
if (!runtimeConfig.headlessSmoke && !runtimeConfig.gpuHandoff && runtimeConfig.splashTheme !== 'off') {
|
||||
let bootStarted = false
|
||||
const tryStartBoot = () => {
|
||||
if (bootStarted || !document.documentElement) return false
|
||||
@@ -54,6 +58,19 @@ if (!runtimeConfig.headlessSmoke && runtimeConfig.splashTheme !== 'off') {
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!runtimeConfig.headlessSmoke &&
|
||||
runtimeConfig.platform === 'win32' &&
|
||||
runtimeConfig.gpuMode === 'auto' &&
|
||||
(runtimeConfig.gpuTarget === 'default' || runtimeConfig.gpuTarget === 'high-performance')
|
||||
) {
|
||||
startDesktopLowFpsWatcher({
|
||||
onLowFps: (report) => {
|
||||
ipcRenderer.send('planet:low-fps-report', report)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
contextBridge.exposeInMainWorld('__PLANET_RUNTIME_CONFIG__', runtimeConfig)
|
||||
|
||||
contextBridge.exposeInMainWorld('planetDesktop', {
|
||||
|
||||
@@ -779,7 +779,7 @@ export function createDesktopSplashController(options: {
|
||||
<div class="splash-presenter-copy">
|
||||
<span class="splash-presenter-kicker">PRESENTED BY</span>
|
||||
<span class="splash-presenter-zh">临空智能媒体研究院</span>
|
||||
<span class="splash-presenter-en">Institute of Intelligent Media</span>
|
||||
<span class="splash-presenter-en">Intelligent Media Institute</span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -1,10 +1,46 @@
|
||||
import { describe, expect, test } from 'bun:test'
|
||||
import { mkdtempSync, rmSync } from 'node:fs'
|
||||
import os from 'node:os'
|
||||
import path from 'node:path'
|
||||
|
||||
import { isGpuProcessCrash, resolveChromiumGpuSwitches } from '../src/main/gpu-policy'
|
||||
import { afterAll, beforeAll, describe, expect, test } from 'bun:test'
|
||||
|
||||
import {
|
||||
DesktopConfigStore,
|
||||
normalizeGpuMode,
|
||||
parseLaunchArgs,
|
||||
readPreReadyGpuHandoff,
|
||||
readPreReadyGpuMode,
|
||||
} from '../src/main/config'
|
||||
import {
|
||||
buildGpuHandoffArgs,
|
||||
canAutoSwitchGpu,
|
||||
chooseStartupGpuTarget,
|
||||
createSustainedLowFpsTracker,
|
||||
createVramHysteresisTracker,
|
||||
detectIntegratedGpuFromRegistryOutput,
|
||||
isGpuProcessCrash,
|
||||
parseNvidiaSmiCsv,
|
||||
resolveChromiumGpuSwitches,
|
||||
stripGpuOverrideArgs,
|
||||
VRAM_LOW_THRESHOLD_MIB,
|
||||
VRAM_RECOVER_THRESHOLD_MIB,
|
||||
} from '../src/main/gpu-policy'
|
||||
import { computeSplashCanvasSize } from '../src/preload/splash'
|
||||
|
||||
let tempRoot = ''
|
||||
|
||||
beforeAll(() => {
|
||||
tempRoot = mkdtempSync(path.join(os.tmpdir(), 'planet-gpu-policy-test-'))
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
if (tempRoot) {
|
||||
rmSync(tempRoot, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
|
||||
describe('chromium GPU switch policy and splash pixel budget', () => {
|
||||
test('win32 hardware mode avoids risky zero-copy and forced GPU switches', () => {
|
||||
test('win32 hardware mode avoids risky zero-copy and forced GPU switches by default', () => {
|
||||
const switches = resolveChromiumGpuSwitches({
|
||||
platform: 'win32',
|
||||
headlessSmoke: false,
|
||||
@@ -14,10 +50,33 @@ describe('chromium GPU switch policy and splash pixel budget', () => {
|
||||
expect(names).not.toContain('enable-zero-copy')
|
||||
expect(names).not.toContain('enable-gpu-rasterization')
|
||||
expect(names).not.toContain('force_high_performance_gpu')
|
||||
expect(names).not.toContain('force_low_power_gpu')
|
||||
expect(names).toContain('disable-renderer-backgrounding')
|
||||
expect(names).not.toContain('ozone-platform-hint')
|
||||
})
|
||||
|
||||
test('low-power and high-performance targets emit matching Chromium GPU preference switches without enable-zero-copy', () => {
|
||||
const igpuSwitches = resolveChromiumGpuSwitches({
|
||||
platform: 'win32',
|
||||
headlessSmoke: false,
|
||||
target: 'low-power',
|
||||
})
|
||||
expect(igpuSwitches).toEqual([
|
||||
{ name: 'force_low_power_gpu' },
|
||||
{ name: 'disable-renderer-backgrounding' },
|
||||
])
|
||||
|
||||
const dgpuSwitches = resolveChromiumGpuSwitches({
|
||||
platform: 'win32',
|
||||
headlessSmoke: false,
|
||||
target: 'high-performance',
|
||||
})
|
||||
expect(dgpuSwitches).toEqual([
|
||||
{ name: 'force_high_performance_gpu' },
|
||||
{ name: 'disable-renderer-backgrounding' },
|
||||
])
|
||||
})
|
||||
|
||||
test('linux hardware mode adds ozone auto hint without enable-zero-copy', () => {
|
||||
const switches = resolveChromiumGpuSwitches({
|
||||
platform: 'linux',
|
||||
@@ -30,10 +89,11 @@ describe('chromium GPU switch policy and splash pixel budget', () => {
|
||||
])
|
||||
})
|
||||
|
||||
test('headless smoke and explicit software-gl select SwiftShader safely', () => {
|
||||
test('headless smoke, explicit software-gl, and target=software select SwiftShader safely', () => {
|
||||
for (const flags of [
|
||||
{ headlessSmoke: true, softwareGl: false },
|
||||
{ headlessSmoke: false, softwareGl: true },
|
||||
{ headlessSmoke: false, target: 'software' as const },
|
||||
]) {
|
||||
const switches = resolveChromiumGpuSwitches({ platform: 'win32', ...flags })
|
||||
expect(switches).toEqual([
|
||||
@@ -70,3 +130,339 @@ describe('chromium GPU switch policy and splash pixel budget', () => {
|
||||
expect(native4k.height).toBe(1620)
|
||||
})
|
||||
})
|
||||
|
||||
describe('adaptive VRAM probing, GPU decision, and hysteresis', () => {
|
||||
test('parseNvidiaSmiCsv parses single and multi-line CSV while skipping invalid rows', () => {
|
||||
expect(
|
||||
parseNvidiaSmiCsv('NVIDIA GeForce RTX 5070 Ti, 14651, 1345, 16303\n'),
|
||||
).toEqual({
|
||||
gpuName: 'NVIDIA GeForce RTX 5070 Ti',
|
||||
usedMiB: 14651,
|
||||
freeMiB: 1345,
|
||||
totalMiB: 16303,
|
||||
})
|
||||
|
||||
expect(
|
||||
parseNvidiaSmiCsv(
|
||||
'\n[N/A], [N/A], [N/A], [N/A]\nNVIDIA GeForce RTX 4090, 4096 MiB, 20480 MiB, 24576 MiB\n',
|
||||
),
|
||||
).toEqual({
|
||||
gpuName: 'NVIDIA GeForce RTX 4090',
|
||||
usedMiB: 4096,
|
||||
freeMiB: 20480,
|
||||
totalMiB: 24576,
|
||||
})
|
||||
|
||||
expect(parseNvidiaSmiCsv('')).toBeNull()
|
||||
expect(parseNvidiaSmiCsv('Failed to initialize NVML')).toBeNull()
|
||||
})
|
||||
|
||||
test('detectIntegratedGpuFromRegistryOutput distinguishes iGPU from single-GPU and virtual adapters', () => {
|
||||
expect(
|
||||
detectIntegratedGpuFromRegistryOutput(`
|
||||
HKEY_LOCAL_MACHINE\\...\\0000
|
||||
DriverDesc REG_SZ Intel(R) Graphics
|
||||
|
||||
HKEY_LOCAL_MACHINE\\...\\0001
|
||||
DriverDesc REG_SZ NVIDIA GeForce RTX 5070 Ti
|
||||
`),
|
||||
).toBe(true)
|
||||
|
||||
expect(
|
||||
detectIntegratedGpuFromRegistryOutput(`
|
||||
DriverDesc REG_SZ AMD Radeon(TM) Graphics
|
||||
DriverDesc REG_SZ NVIDIA GeForce RTX 4060 Laptop GPU
|
||||
`),
|
||||
).toBe(true)
|
||||
|
||||
expect(
|
||||
detectIntegratedGpuFromRegistryOutput(`
|
||||
DriverDesc REG_SZ NVIDIA GeForce RTX 5070 Ti
|
||||
DriverDesc REG_SZ Microsoft Basic Display Adapter
|
||||
DriverDesc REG_SZ Parsec Virtual Display Adapter
|
||||
`),
|
||||
).toBe(false)
|
||||
|
||||
expect(
|
||||
detectIntegratedGpuFromRegistryOutput(`
|
||||
DriverDesc REG_SZ Intel(R) Arc(TM) A770 Graphics
|
||||
DriverDesc REG_SZ NVIDIA GeForce RTX 5070 Ti
|
||||
`),
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
test('chooseStartupGpuTarget handles low VRAM auto offload, recovery, explicit modes, and smoke', () => {
|
||||
const lowVramSample = {
|
||||
gpuName: 'NVIDIA GeForce RTX 5070 Ti',
|
||||
usedMiB: 14651,
|
||||
freeMiB: 1345,
|
||||
totalMiB: 16303,
|
||||
}
|
||||
const healthyVramSample = {
|
||||
gpuName: 'NVIDIA GeForce RTX 5070 Ti',
|
||||
usedMiB: 4000,
|
||||
freeMiB: 8000,
|
||||
totalMiB: 16303,
|
||||
}
|
||||
|
||||
expect(
|
||||
chooseStartupGpuTarget({
|
||||
platform: 'win32',
|
||||
headlessSmoke: false,
|
||||
requestedMode: 'auto',
|
||||
vramSample: lowVramSample,
|
||||
hasIntegratedGpu: true,
|
||||
}),
|
||||
).toEqual({
|
||||
target: 'low-power',
|
||||
requestedMode: 'auto',
|
||||
reason: 'low-vram-igpu',
|
||||
vramSample: lowVramSample,
|
||||
hasIntegratedGpu: true,
|
||||
})
|
||||
|
||||
expect(
|
||||
chooseStartupGpuTarget({
|
||||
platform: 'win32',
|
||||
headlessSmoke: false,
|
||||
requestedMode: 'auto',
|
||||
vramSample: lowVramSample,
|
||||
hasIntegratedGpu: false,
|
||||
}),
|
||||
).toEqual({
|
||||
target: 'software',
|
||||
requestedMode: 'auto',
|
||||
reason: 'low-vram-software',
|
||||
vramSample: lowVramSample,
|
||||
hasIntegratedGpu: false,
|
||||
})
|
||||
|
||||
expect(
|
||||
chooseStartupGpuTarget({
|
||||
platform: 'win32',
|
||||
headlessSmoke: false,
|
||||
requestedMode: 'auto',
|
||||
vramSample: healthyVramSample,
|
||||
hasIntegratedGpu: true,
|
||||
}),
|
||||
).toEqual({
|
||||
target: 'default',
|
||||
requestedMode: 'auto',
|
||||
reason: 'normal-gpu',
|
||||
vramSample: healthyVramSample,
|
||||
hasIntegratedGpu: true,
|
||||
})
|
||||
|
||||
expect(
|
||||
chooseStartupGpuTarget({
|
||||
platform: 'win32',
|
||||
headlessSmoke: false,
|
||||
requestedMode: 'high-performance',
|
||||
vramSample: lowVramSample,
|
||||
hasIntegratedGpu: true,
|
||||
}).reason,
|
||||
).toBe('user-high-performance')
|
||||
|
||||
expect(
|
||||
chooseStartupGpuTarget({
|
||||
platform: 'win32',
|
||||
headlessSmoke: false,
|
||||
requestedMode: 'low-power',
|
||||
vramSample: healthyVramSample,
|
||||
hasIntegratedGpu: true,
|
||||
}).target,
|
||||
).toBe('low-power')
|
||||
|
||||
expect(
|
||||
chooseStartupGpuTarget({
|
||||
platform: 'win32',
|
||||
headlessSmoke: true,
|
||||
requestedMode: 'high-performance',
|
||||
vramSample: healthyVramSample,
|
||||
hasIntegratedGpu: true,
|
||||
}),
|
||||
).toMatchObject({ target: 'software', reason: 'headless-smoke' })
|
||||
})
|
||||
|
||||
test('createVramHysteresisTracker enforces consecutive readings and deadband', () => {
|
||||
const lowSample = { gpuName: 'RTX 5070 Ti', usedMiB: 14500, freeMiB: 1500, totalMiB: 16303 }
|
||||
const midSample = { gpuName: 'RTX 5070 Ti', usedMiB: 13000, freeMiB: 3000, totalMiB: 16303 }
|
||||
const highSample = { gpuName: 'RTX 5070 Ti', usedMiB: 11000, freeMiB: VRAM_RECOVER_THRESHOLD_MIB, totalMiB: 16303 }
|
||||
|
||||
const igpuTracker = createVramHysteresisTracker({
|
||||
activeTarget: 'low-power',
|
||||
hasIntegratedGpu: true,
|
||||
})
|
||||
expect(igpuTracker.observe(midSample)).toBeNull()
|
||||
expect(igpuTracker.observe(highSample)).toBeNull()
|
||||
expect(igpuTracker.observe(midSample)).toBeNull() // streak reset
|
||||
expect(igpuTracker.observe(highSample)).toBeNull()
|
||||
expect(igpuTracker.observe(highSample)).toEqual({
|
||||
kind: 'switch-to-discrete',
|
||||
sample: highSample,
|
||||
})
|
||||
|
||||
const dgpuWithIgpu = createVramHysteresisTracker({
|
||||
activeTarget: 'default',
|
||||
hasIntegratedGpu: true,
|
||||
})
|
||||
expect(dgpuWithIgpu.observe(midSample)).toBeNull()
|
||||
expect(dgpuWithIgpu.observe({ ...lowSample, freeMiB: VRAM_LOW_THRESHOLD_MIB - 1 })).toBeNull()
|
||||
expect(dgpuWithIgpu.observe(null)).toBeNull() // missing reading resets streak
|
||||
expect(dgpuWithIgpu.observe(lowSample)).toBeNull()
|
||||
expect(dgpuWithIgpu.observe(lowSample)).toEqual({
|
||||
kind: 'switch-to-low-power',
|
||||
sample: lowSample,
|
||||
})
|
||||
|
||||
const dgpuNoIgpu = createVramHysteresisTracker({
|
||||
activeTarget: 'high-performance',
|
||||
hasIntegratedGpu: false,
|
||||
})
|
||||
expect(dgpuNoIgpu.observe(lowSample)).toBeNull()
|
||||
expect(dgpuNoIgpu.observe(lowSample)).toEqual({
|
||||
kind: 'switch-to-software',
|
||||
sample: lowSample,
|
||||
})
|
||||
})
|
||||
|
||||
test('stripGpuOverrideArgs removes CLI GPU override flags cleanly', () => {
|
||||
expect(
|
||||
stripGpuOverrideArgs([
|
||||
'--fullscreen',
|
||||
'--software-gl',
|
||||
'--gpu-mode=low-power',
|
||||
'--gpu-mode',
|
||||
'high-performance',
|
||||
'--low-power-gpu',
|
||||
'--high-performance-gpu',
|
||||
'planet-earth://open',
|
||||
]),
|
||||
).toEqual(['--fullscreen', 'planet-earth://open'])
|
||||
})
|
||||
|
||||
test('gpuMode config normalization, CLI flags, persistence, and readPreReadyGpuMode precedence work', () => {
|
||||
expect(normalizeGpuMode('AUTO')).toBe('auto')
|
||||
expect(normalizeGpuMode('igpu')).toBe('low-power')
|
||||
expect(normalizeGpuMode('discrete')).toBe('high-performance')
|
||||
expect(normalizeGpuMode('cpu')).toBe('software')
|
||||
expect(normalizeGpuMode('unknown', 'low-power')).toBe('low-power')
|
||||
|
||||
expect(parseLaunchArgs(['--low-power-gpu']).flags.gpuModeOverride).toBe('low-power')
|
||||
expect(parseLaunchArgs(['--high-performance-gpu']).flags.gpuModeOverride).toBe('high-performance')
|
||||
expect(parseLaunchArgs(['--software-gl']).flags.gpuModeOverride).toBe('software')
|
||||
expect(parseLaunchArgs(['--gpu-mode', 'igpu']).flags.gpuModeOverride).toBe('low-power')
|
||||
|
||||
const userDataDir = path.join(tempRoot, 'gpu-user-data')
|
||||
const exeDir = path.join(tempRoot, 'gpu-exe-dir')
|
||||
const store = new DesktopConfigStore({ userDataDir, exeDir, argv: [], env: {} })
|
||||
expect(store.get().gpuMode).toBe('auto')
|
||||
store.updateEndpoints({ backendUrl: 'https://rclaw.test' })
|
||||
store.updateGpuMode('low-power')
|
||||
|
||||
expect(
|
||||
readPreReadyGpuMode({ userDataDir, exeDir, argv: [], env: {} }),
|
||||
).toBe('low-power')
|
||||
expect(
|
||||
readPreReadyGpuMode({ userDataDir, exeDir, argv: [], env: { PLANET_GPU_MODE: 'high-performance' } }),
|
||||
).toBe('high-performance')
|
||||
expect(
|
||||
readPreReadyGpuMode({
|
||||
userDataDir,
|
||||
exeDir,
|
||||
argv: ['--software-gl'],
|
||||
env: { PLANET_GPU_MODE: 'high-performance' },
|
||||
}),
|
||||
).toBe('software')
|
||||
|
||||
const reloaded = new DesktopConfigStore({ userDataDir, exeDir, argv: [], env: {} })
|
||||
expect(reloaded.get().gpuMode).toBe('low-power')
|
||||
expect(reloaded.get().backendUrl).toBe('https://rclaw.test')
|
||||
})
|
||||
|
||||
test('createSustainedLowFpsTracker ignores brief dips and triggers after 5s below 20 FPS with cooldown', () => {
|
||||
const tracker = createSustainedLowFpsTracker()
|
||||
let now = 0
|
||||
expect(tracker.onFrame(now)).toBeNull()
|
||||
|
||||
// Simulate 10 FPS (100ms frame delta) for 4 seconds -> not yet 5s sustained
|
||||
for (let sec = 0; sec < 4; sec += 1) {
|
||||
for (let f = 0; f < 10; f += 1) {
|
||||
now += 100
|
||||
expect(tracker.onFrame(now)).toBeNull()
|
||||
}
|
||||
}
|
||||
|
||||
// Recover above 20 FPS -> resets low streak
|
||||
for (let f = 0; f < 30; f += 1) {
|
||||
now += 35
|
||||
expect(tracker.onFrame(now)).toBeNull()
|
||||
}
|
||||
|
||||
// Now sustain 10 FPS for 5 full seconds -> triggers on 5th second
|
||||
let trigger: { avgFps: number; sustainedMs: number } | null = null
|
||||
for (let sec = 0; sec < 5; sec += 1) {
|
||||
for (let f = 0; f < 10; f += 1) {
|
||||
now += 100
|
||||
const res = tracker.onFrame(now)
|
||||
if (res) trigger = res
|
||||
}
|
||||
}
|
||||
expect(trigger).not.toBeNull()
|
||||
expect(trigger!.avgFps).toBeGreaterThanOrEqual(9.5)
|
||||
expect(trigger!.avgFps).toBeLessThan(11)
|
||||
expect(trigger!.sustainedMs).toBeGreaterThanOrEqual(5000)
|
||||
|
||||
// Within 15s report cooldown -> suppressed even if slow again
|
||||
for (let sec = 0; sec < 5; sec += 1) {
|
||||
for (let f = 0; f < 10; f += 1) {
|
||||
now += 100
|
||||
expect(tracker.onFrame(now)).toBeNull()
|
||||
}
|
||||
}
|
||||
|
||||
// Reset clears accumulated low duration cleanly
|
||||
tracker.reset()
|
||||
now += 20_000
|
||||
expect(tracker.onFrame(now)).toBeNull()
|
||||
for (let sec = 0; sec < 4; sec += 1) {
|
||||
for (let f = 0; f < 10; f += 1) {
|
||||
now += 100
|
||||
expect(tracker.onFrame(now)).toBeNull()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
test('canAutoSwitchGpu, handoff target decision, and handoff CLI args preserve state across relaunch', () => {
|
||||
expect(canAutoSwitchGpu(null, 10_000)).toBe(true)
|
||||
expect(canAutoSwitchGpu(10_000, 40_000)).toBe(false)
|
||||
expect(canAutoSwitchGpu(10_000, 55_000)).toBe(true)
|
||||
|
||||
expect(
|
||||
chooseStartupGpuTarget({
|
||||
platform: 'win32',
|
||||
headlessSmoke: false,
|
||||
requestedMode: 'auto',
|
||||
handoffTarget: 'low-power',
|
||||
vramSample: null,
|
||||
hasIntegratedGpu: true,
|
||||
}),
|
||||
).toMatchObject({ target: 'low-power', reason: 'gpu-handoff' })
|
||||
|
||||
const args = buildGpuHandoffArgs(
|
||||
['--fullscreen', '--gpu-handoff', '--gpu-handoff-target=low-power', 'planet-earth://open'],
|
||||
'default',
|
||||
)
|
||||
expect(args).toEqual([
|
||||
'--fullscreen',
|
||||
'planet-earth://open',
|
||||
'--gpu-handoff',
|
||||
'--gpu-handoff-target=default',
|
||||
])
|
||||
expect(readPreReadyGpuHandoff(args)).toEqual({
|
||||
gpuHandoff: true,
|
||||
gpuHandoffTarget: 'default',
|
||||
})
|
||||
expect(stripGpuOverrideArgs(args)).toEqual(['--fullscreen', 'planet-earth://open'])
|
||||
})
|
||||
})
|
||||
@@ -8,6 +8,18 @@ This project follows the repository versioning rule:
|
||||
- `improvement` -> `+0.0.1`(bugfix + 小功能混合)
|
||||
- `bugfix` -> `+0.0.1`
|
||||
|
||||
## [0.79.1] — 2026-11-24
|
||||
|
||||
Released: 2026-11-24
|
||||
|
||||
### Highlights
|
||||
|
||||
- On Windows, automatic GPU selection checks free discrete GPU memory at startup. Below 2 GiB it requests integrated graphics when available and falls back to software rendering otherwise.
|
||||
- During use, five seconds below 20 FPS prompts a second memory check before switching away from the discrete GPU. An automatic switch starts a 45-second cooldown. Once it expires, the client checks every five seconds and switches back after two consecutive readings of at least 3.5 GiB free. Automatic relaunches skip the splash and restore the window state.
|
||||
- The splash screen and Earth interface now use **Intelligent Media Institute** as the English name of 临空智能媒体研究院 (IMI).
|
||||
|
||||
---
|
||||
|
||||
## [0.79.0] — 2026-11-24
|
||||
|
||||
Released: 2026-11-24
|
||||
|
||||
@@ -44,7 +44,7 @@ Earth now supports both a **Web browser entry** and a **native Electron desktop
|
||||
- **Runtime endpoint injection**: Preload injects synchronous `window.__PLANET_RUNTIME_CONFIG__` (`backendUrl`, `adminUrl`, `wsUrl`, `motionWsUrl`, `localMediaPipeBaseUrl`, `isElectron`) and `window.planetDesktop`. `realtime.js`, `motion-control.js`, and `motion-browser-provider.js` consume those endpoints and load bundled MediaPipe assets locally first.
|
||||
- **Cross-process live synchronization**: Because Electron Earth runs outside the Admin origin, backend API mutations for compute comparison settings, brand config, and about info push `earth_updates` reload hints (`compute_configuration`, `earth_brand`, `earth_about`) over `/ws` alongside same-origin `BroadcastChannel` notices.
|
||||
- **Native window controls and frame pacing**: Desktop uses a native dark OS frame so window buttons never overlap `#media-panel`, lowers minimum window dimensions to `360×480` so manual narrowing enters Earth's mobile layout (`<= 820px`), and adds one-click **View → Toggle Portrait & Landscape** (`CmdOrCtrl+Shift+M`) in the native `Alt` menu bar alongside saved portrait/landscape bounds; it also locks Chromium page zoom (`setVisualZoomLevelLimits(1, 1)`) while forwarding pinch (`wheel + ctrlKey`) and `CmdOrCtrl + =/-/0` to 3D globe zoom, and stabilizes frame pacing by coalescing HUD glow pointer moves and globe hover raycasting into `requestAnimationFrame`, caching `DOMRect` via `ResizeObserver`, clamping `deltaTime` (`<= 50 ms`), and pausing renders on minimize via `planet-desktop:visibility`.
|
||||
- **Switchable desktop splash screen and zero-flash readiness gate**: [Desktop splash controller](/home/ray/dev/linkong/planet/client/src/preload/splash.ts) mounts via a `document` `MutationObserver` in preload the instant `<html>` is created and synchronously paints frame 1, while [Window show gate](/home/ray/dev/linkong/planet/client/src/main/show-gate.ts) waits for both `ready-to-show` and `planet:splash-first-paint` before showing the OS window so raw HTML never flashes; meanwhile `frontend/public/earth/js/main.js` and `controls.js` emit non-visual `earth:startup-progress` and `earth:startup-ready` lifecycle events (with zero Web UI/DOM impact) only after startup layers, `applyDeferredLayerVisibilitySettings` user-preference layers, stats/media readiness, and rendered 3D GPU frames settle before revealing the Earth viewport. It provides three real-coastline 3D Canvas themes (`singularity`, `constellation`, `horizon`, plus `off`), displays the transparent ZJU seal (`zju-emblem.png`) and `PRESENTED BY 临空智能媒体研究院 / Institute of Intelligent Media` lockup, and is controllable via splash pills, `Planet Earth → Splash Screen`, `CmdOrCtrl+Shift+S`, or `--splash-theme`.
|
||||
- **Switchable desktop splash screen and zero-flash readiness gate**: [Desktop splash controller](/home/ray/dev/linkong/planet/client/src/preload/splash.ts) mounts via a `document` `MutationObserver` in preload the instant `<html>` is created and synchronously paints frame 1, while [Window show gate](/home/ray/dev/linkong/planet/client/src/main/show-gate.ts) waits for both `ready-to-show` and `planet:splash-first-paint` before showing the OS window so raw HTML never flashes; meanwhile `frontend/public/earth/js/main.js` and `controls.js` emit non-visual `earth:startup-progress` and `earth:startup-ready` lifecycle events (with zero Web UI/DOM impact) only after startup layers, `applyDeferredLayerVisibilitySettings` user-preference layers, stats/media readiness, and rendered 3D GPU frames settle before revealing the Earth viewport. It provides three real-coastline 3D Canvas themes (`singularity`, `constellation`, `horizon`, plus `off`), displays the transparent ZJU seal (`zju-emblem.png`) and `PRESENTED BY 临空智能媒体研究院 / Intelligent Media Institute` lockup, and is controllable via splash pills, `Planet Earth → Splash Screen`, `CmdOrCtrl+Shift+S`, or `--splash-theme`.
|
||||
|
||||
Earth frontend is essentially a single shared visualization core under `public/earth` powering both Web and Desktop.
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ Earth 现同时支持**Web 浏览入口**与**原生 Electron 桌面客户端入
|
||||
- **运行时端点注入**:桌面预加载脚本暴露同步 `window.__PLANET_RUNTIME_CONFIG__`(`backendUrl`、`adminUrl`、`wsUrl`、`motionWsUrl`、`localMediaPipeBaseUrl`、`isElectron`)及受控 `window.planetDesktop` 桥接,`realtime.js`、`motion-control.js` 与 `motion-browser-provider.js` 自动读取该配置并优先加载本地 MediaPipe WASM。
|
||||
- **跨进程实时同步**:由于 Electron 桌面端与 `planet_admin` 容器不在同一浏览器源,后台对算力配置、Earth 品牌信息及关于信息的修改除广播 `BroadcastChannel` 外,同时经后端 WebSocket 推送 `earth_updates`(`compute_configuration` / `earth_brand` / `earth_about`),使桌面端与浏览器端同步刷新。
|
||||
- **原生窗口与帧率稳定**:桌面端使用原生暗色标题栏避免遮挡右上角 `#media-panel`,窗口最小尺寸放宽至 `360×480` 以支持手动拖窄进入移动端布局(`<= 820px`),并可通过 `Alt` 菜单栏 **视图 / View → 切换横竖屏 / Toggle Portrait & Landscape**(或 `CmdOrCtrl+Shift+M`)一键切换横竖屏比例;同时禁用 Chromium 页面缩放并将触控板捏合(`wheel + ctrlKey`)及 `CmdOrCtrl + =/-/0` 映射至 3D 视角缩放;`controls.js` 对液态玻璃光斑响应、`frame-stats.js` 布局刷新与 `main.js` 地球悬停拾取采用 `ResizeObserver` + `requestAnimationFrame` 合帧并限制 `deltaTime` 尖峰,窗口最小化时通过 `planet-desktop:visibility` 暂停空转渲染。
|
||||
- **多方案桌面端启动画面与无闪烁就绪门控**:[桌面端启动画面控制器](/home/ray/dev/linkong/planet/client/src/preload/splash.ts) 通过预加载脚本里的 `document` `MutationObserver` 在解析出 `<html>` 的第一时间挂载隔离 Shadow DOM 蒙层并同步绘制首帧,[窗口展示门控](/home/ray/dev/linkong/planet/client/src/main/show-gate.ts) 同时等待 `ready-to-show` 与 `planet:splash-first-paint` 后才显示窗口,彻底消除启动瞬间的原始网页闪屏;同时 `frontend/public/earth/js/main.js` 与 `controls.js` 在保持 Web 端视觉与交互完全一致的前提下,通过非可视化的 `earth:startup-progress` / `earth:startup-ready` 生命周期事件在完成 `applyDeferredLayerVisibilitySettings` 用户偏好图层恢复、统计/新闻直播初始化及首帧 3D GPU 渲染后再触发星核/星轨/破晓退场;内置三套 3D Canvas 动态启动方案(`singularity` / `constellation` / `horizon`),展示透明浙大校徽与 `PRESENTED BY 临空智能媒体研究院 / Institute of Intelligent Media` 署名,可通过启动页切换按钮、`Alt → Planet Earth → 启动画面方案`、`CmdOrCtrl+Shift+S` 重播及 `--splash-theme` 切换。
|
||||
- **多方案桌面端启动画面与无闪烁就绪门控**:[桌面端启动画面控制器](/home/ray/dev/linkong/planet/client/src/preload/splash.ts) 通过预加载脚本里的 `document` `MutationObserver` 在解析出 `<html>` 的第一时间挂载隔离 Shadow DOM 蒙层并同步绘制首帧,[窗口展示门控](/home/ray/dev/linkong/planet/client/src/main/show-gate.ts) 同时等待 `ready-to-show` 与 `planet:splash-first-paint` 后才显示窗口,彻底消除启动瞬间的原始网页闪屏;同时 `frontend/public/earth/js/main.js` 与 `controls.js` 在保持 Web 端视觉与交互完全一致的前提下,通过非可视化的 `earth:startup-progress` / `earth:startup-ready` 生命周期事件在完成 `applyDeferredLayerVisibilitySettings` 用户偏好图层恢复、统计/新闻直播初始化及首帧 3D GPU 渲染后再触发星核/星轨/破晓退场;内置三套 3D Canvas 动态启动方案(`singularity` / `constellation` / `horizon`),展示透明浙大校徽与 `PRESENTED BY 临空智能媒体研究院 / Intelligent Media Institute` 署名,可通过启动页切换按钮、`Alt → Planet Earth → 启动画面方案`、`CmdOrCtrl+Shift+S` 重播及 `--splash-theme` 切换。
|
||||
|
||||
所以 Earth 前端本质上是 `public/earth` 下的一套独立可视化内核,同时服务 Web 与桌面端。
|
||||
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
## Current Version
|
||||
|
||||
- `main` 当前主线历史推导到:`0.16.5`
|
||||
- `dev` 当前开发分支历史推导到:`0.79.0`
|
||||
- `dev` 当前开发分支历史推导到:`0.79.1`
|
||||
|
||||
## Timeline
|
||||
|
||||
| Version | Type | Branch | Commit | Summary |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `0.79.1` | improvement | `dev` | `v0.79.1` | Windows 根据显存与帧率自动切换显卡,保留 45 秒切换冷却与窗口状态,统一 IMI 英文名称 |
|
||||
| `0.79.0` | feature | `dev` | `v0.79.0` | 破晓-星核统一启动动效、Phase 1 L1 热更新体系与 Windows GPU/WebGL 恢复加固 |
|
||||
| `0.78.0` | feature | `dev` | `v0.78.0` | 全局单份采集策略、短期船舶航迹、精简生产部署和桌面协议注册 |
|
||||
| `0.77.0` | feature | `dev` | `v0.77.0` | 新增原生 Electron Earth 桌面客户端(多方案 3D 启动页/横竖屏/离线协议/Gitea 自动发布)、轻量 Admin 独立容器、全球综合态势工作台与算力对比增强 |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "planet-frontend",
|
||||
"version": "0.79.0",
|
||||
"version": "0.79.1",
|
||||
"private": true,
|
||||
"packageManager": "bun@1",
|
||||
"dependencies": {
|
||||
|
||||
@@ -871,7 +871,7 @@ const EXACT_TRANSLATIONS = {
|
||||
"出品方": "Producer",
|
||||
"策划人": "Planners",
|
||||
"产品兼开发者": "Product & Development",
|
||||
"浙江大学临空智能媒体研究院": "Zhejiang University Linkong Institute of Intelligent Media",
|
||||
"浙江大学临空智能媒体研究院": "Zhejiang University Linkong Intelligent Media Institute",
|
||||
"方兴东、黄柳青": "Fang Xingdong, Huang Liuqing",
|
||||
"钱坤、张鸽、齐鹏": "Qian Kun, Zhang Ge, Qi Peng",
|
||||
"面向临空场景下的智能媒体研究、全球态势感知与多源开放数据巡航,提供可视化观测、事件聚合与交互式探索能力。": "For intelligent media research, global situational awareness, and multi-source open-data cruise in linkong scenarios, providing visual observation, event aggregation, and interactive exploration.",
|
||||
@@ -981,7 +981,7 @@ const EXACT_TRANSLATIONS = {
|
||||
"搜索结果": "Search results",
|
||||
"调整地球默认大小": "Adjust default Earth size",
|
||||
"调整地形透明度": "Adjust terrain opacity",
|
||||
"浙江大学临空智能媒体研究院 Logo": "Zhejiang University Linkong Institute of Intelligent Media Logo",
|
||||
"浙江大学临空智能媒体研究院 Logo": "Zhejiang University Linkong Intelligent Media Institute Logo",
|
||||
"Earth 页面发生未捕获错误": "Earth page uncaught error",
|
||||
"Earth 页面发生未处理 Promise 错误": "Earth page unhandled Promise error",
|
||||
"等待动捕数据": "Waiting for motion data",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "planet"
|
||||
version = "0.79.0"
|
||||
version = "0.79.1"
|
||||
description = "智能星球计划 - 态势感知系统"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = [
|
||||
|
||||
Reference in new issue
Block a user