Report camera readiness in /airdef capabilities
Pin the engine at 6a53a626c (API 30) and show render.camera-status: the calling run's set-views cameras, whether the last noted frame was a world frame, the request's world generation, each camera's reason and the run's own main-view selection. As the other lines, this is a host milestone: availability, request, preparation and why, not a GPU frame or a visible picture. A unit test pins the line: readiness stays per camera and apart from the run's main-view selection. docs/ENGINE.md, the 4 November continuation and the status table now say what prepared means (a picture encoded into the camera's target, or a world frame drawn from it as this run's screen view, only for the run whose selection the screen used), the per-run/per-world resets, and what remains: GPU acceptance. Verified: python3 tools/airdef.py check (gitlink, packer, mod needs 30, fork 30, game 30); test-wasm 27 steps; airdef-mod 65 unit, 1 boundary and 5 scenarios; python3 -m unittest discover -s tools 28 tests. Co-Authored-By: Kimi Code <noreply@moonshot.cn>
This commit is contained in:
@@ -59,12 +59,42 @@ fn line(
|
||||
format!("{name}: API={available}, включено={enabled}, запрос={accepted}, подготовлено={prepared}, поколение={generation}, {why}")
|
||||
}
|
||||
|
||||
fn camera_line(s: &render::CameraState) -> String {
|
||||
let cameras: Vec<String> = s
|
||||
.cameras
|
||||
.iter()
|
||||
.map(|c| {
|
||||
let why = match c.reason {
|
||||
render::CameraReason::AwaitingFrame => "awaiting-frame",
|
||||
render::CameraReason::Ready => "ready",
|
||||
};
|
||||
format!("{}:{}", c.id, why)
|
||||
})
|
||||
.collect();
|
||||
let main = match s.main_view {
|
||||
Some(id) => id.to_string(),
|
||||
None => "нет".into(),
|
||||
};
|
||||
format!(
|
||||
"Камеры: API={}, включено={}, запрос={}, подготовлено={}, поколение={}, {}, main={}, [{}]",
|
||||
s.available,
|
||||
s.enabled,
|
||||
s.request_accepted,
|
||||
s.prepared,
|
||||
s.generation,
|
||||
reason(s.reason),
|
||||
main,
|
||||
cameras.join("; ")
|
||||
)
|
||||
}
|
||||
|
||||
pub fn diagnostics() -> String {
|
||||
let smoke = render::smoke_status();
|
||||
let acoustic = acoustics();
|
||||
let capture = render::capture_owner_status();
|
||||
let lights = render::point_lights_status();
|
||||
let sources = render::sound_sources_status();
|
||||
let cameras = render::camera_status();
|
||||
let smoke_reason = match smoke.reason {
|
||||
render::SmokeReason::AwaitingFrame => "awaiting-frame",
|
||||
render::SmokeReason::Disabled => "disabled",
|
||||
@@ -72,7 +102,7 @@ pub fn diagnostics() -> String {
|
||||
render::SmokeReason::Ready => "ready",
|
||||
};
|
||||
[
|
||||
"Возможности движка (API 29; подготовка не означает готовый GPU-кадр, слышимый звук или файл):".into(),
|
||||
"Возможности движка (API 30; подготовка не означает готовый GPU-кадр, слышимый звук или файл):".into(),
|
||||
line(
|
||||
"Дым",
|
||||
smoke.generation,
|
||||
@@ -109,6 +139,7 @@ pub fn diagnostics() -> String {
|
||||
sources.prepared,
|
||||
reason(sources.reason),
|
||||
),
|
||||
camera_line(&cameras),
|
||||
line(
|
||||
"Захват этого мода",
|
||||
capture.generation,
|
||||
@@ -164,4 +195,46 @@ mod tests {
|
||||
s.reason = CapabilityReason::Failed;
|
||||
assert!(capture_problem(&s).is_some());
|
||||
}
|
||||
fn camera(id: u32, prepared: bool) -> render::CameraReadiness {
|
||||
render::CameraReadiness {
|
||||
id,
|
||||
request_accepted: true,
|
||||
prepared,
|
||||
reason: if prepared {
|
||||
render::CameraReason::Ready
|
||||
} else {
|
||||
render::CameraReason::AwaitingFrame
|
||||
},
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn the_camera_line_separates_readiness_from_the_screens_selection() {
|
||||
let line = camera_line(&render::CameraState {
|
||||
generation: 5,
|
||||
available: true,
|
||||
enabled: true,
|
||||
request_accepted: true,
|
||||
prepared: true,
|
||||
reason: CapabilityReason::Ready,
|
||||
cameras: vec![camera(7, true), camera(8, false)],
|
||||
main_view: Some(7),
|
||||
});
|
||||
assert_eq!(
|
||||
line,
|
||||
"Камеры: API=true, включено=true, запрос=true, подготовлено=true, поколение=5, \
|
||||
ready, main=7, [7:ready; 8:awaiting-frame]"
|
||||
);
|
||||
// No accepted submission: no cameras, no main view, and the reason says so.
|
||||
let line = camera_line(&render::CameraState {
|
||||
generation: 5,
|
||||
available: true,
|
||||
enabled: false,
|
||||
request_accepted: false,
|
||||
prepared: false,
|
||||
reason: CapabilityReason::NotRequested,
|
||||
cameras: Vec::new(),
|
||||
main_view: None,
|
||||
});
|
||||
assert!(line.ends_with("not-requested, main=нет, []"), "{line}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user