69 lines
2.3 KiB
Rust
69 lines
2.3 KiB
Rust
#[cfg(test)]
|
|
mod async_render_contract_tests;
|
|
mod dispatch;
|
|
mod frame_scheduler;
|
|
mod lifecycle;
|
|
pub mod render_manager;
|
|
mod render_worker;
|
|
pub mod render_worker_handoff;
|
|
#[cfg(test)]
|
|
pub(crate) mod render_worker_test_harness;
|
|
#[cfg(test)]
|
|
mod tests;
|
|
mod tick;
|
|
|
|
use crate::CrashReport;
|
|
pub use frame_scheduler::FrameScheduler;
|
|
use prometeu_bytecode::string_materialization_count;
|
|
use prometeu_hal::app_mode::AppMode;
|
|
use prometeu_hal::log::LogService;
|
|
use prometeu_hal::telemetry::{AtomicTelemetry, CertificationConfig, Certifier};
|
|
use prometeu_hal::{Gfx2dCommand, GfxUiCommand};
|
|
use prometeu_vm::VirtualMachine;
|
|
pub use render_manager::{RenderManager, RenderRuntimeCapabilities};
|
|
pub use render_worker::{RenderWorkerConfig, RenderWorkerController};
|
|
pub use render_worker_handoff::{RenderWorkerHandoff, RenderWorkerHandoffWait};
|
|
use std::collections::HashMap;
|
|
use std::sync::Arc;
|
|
use std::sync::atomic::AtomicU32;
|
|
use std::time::Instant;
|
|
|
|
pub struct VirtualMachineRuntime {
|
|
pub tick_index: u64,
|
|
pub logical_frame_index: u64,
|
|
pub logical_frame_active: bool,
|
|
pub logical_frame_remaining_cycles: u64,
|
|
pub last_frame_cpu_time_us: u64,
|
|
pub current_app_id: u32,
|
|
pub current_cartridge_title: String,
|
|
pub current_cartridge_app_version: String,
|
|
pub current_cartridge_app_mode: AppMode,
|
|
pub frame_scheduler: FrameScheduler,
|
|
pub render_capabilities: RenderRuntimeCapabilities,
|
|
pub render_manager: RenderManager,
|
|
pub gfx2d_commands: Vec<Gfx2dCommand>,
|
|
pub gfxui_commands: Vec<GfxUiCommand>,
|
|
pub logs_written_this_frame: HashMap<u32, u32>,
|
|
pub atomic_telemetry: Arc<AtomicTelemetry>,
|
|
pub last_crash_report: Option<CrashReport>,
|
|
pub certifier: Certifier,
|
|
pub paused: bool,
|
|
pub debug_step_request: bool,
|
|
pub inspection_active: bool,
|
|
pub(crate) frame_start_heap_allocations: u64,
|
|
pub(crate) frame_start_string_materializations: u64,
|
|
pub(crate) needs_prepare_entry_call: bool,
|
|
pub(crate) boot_time: Instant,
|
|
}
|
|
|
|
impl VirtualMachineRuntime {
|
|
pub const CYCLES_PER_LOGICAL_FRAME: u64 = 1_500_000;
|
|
pub const SLICE_PER_TICK: u64 = 1_500_000;
|
|
pub const MAX_LOG_LEN: usize = 256;
|
|
pub const MAX_LOGS_PER_FRAME: u32 = 10;
|
|
|
|
pub fn new(cap_config: Option<CertificationConfig>) -> Self {
|
|
Self::new_with_log_counter(cap_config, Arc::new(AtomicU32::new(0)))
|
|
}
|
|
}
|