implements PLN-0082 render publication boundary
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use super::dispatch::VmRuntimeHost;
|
||||
use super::render_manager::RenderSurface;
|
||||
use super::*;
|
||||
use crate::CrashReport;
|
||||
use crate::fs::{FsState, VirtualFS};
|
||||
@@ -6,13 +7,24 @@ use crate::services::memcard::MemcardService;
|
||||
use prometeu_hal::asset::{BankTelemetry, BankType};
|
||||
use prometeu_hal::log::{LogLevel, LogService, LogSource};
|
||||
use prometeu_hal::{
|
||||
HardwareBridge, HostContext, InputSignals, RenderSubmissionPacket, ShellUiFramePacket,
|
||||
HardwareBridge, HostContext, InputSignals, RenderSubmission, RenderSubmissionPacket,
|
||||
ShellUiFramePacket,
|
||||
};
|
||||
use prometeu_vm::LogicalFrameEndingReason;
|
||||
use std::collections::HashMap;
|
||||
use std::panic::{AssertUnwindSafe, catch_unwind};
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
struct HardwareRenderSurface<'a> {
|
||||
hw: &'a mut dyn HardwareBridge,
|
||||
}
|
||||
|
||||
impl RenderSurface for HardwareRenderSurface<'_> {
|
||||
fn consume_submission(&mut self, submission: &RenderSubmission) {
|
||||
self.hw.publish_render_submission(submission);
|
||||
}
|
||||
}
|
||||
|
||||
impl VirtualMachineRuntime {
|
||||
fn host_panic_payload_to_string(payload: Box<dyn std::any::Any + Send>) -> String {
|
||||
if let Some(message) = payload.downcast_ref::<String>() {
|
||||
@@ -237,7 +249,10 @@ impl VirtualMachineRuntime {
|
||||
.expect("shell packet must match Shell app mode");
|
||||
}
|
||||
|
||||
if let Err(payload) = catch_unwind(AssertUnwindSafe(|| hw.render_frame())) {
|
||||
if let Err(payload) = catch_unwind(AssertUnwindSafe(|| {
|
||||
let mut surface = HardwareRenderSurface { hw };
|
||||
self.render_manager.publish_latest(&mut surface);
|
||||
})) {
|
||||
let message = Self::host_panic_payload_to_string(payload);
|
||||
let report = CrashReport::VmPanic { message, pc: Some(vm.pc() as u32) };
|
||||
self.log(
|
||||
|
||||
Reference in New Issue
Block a user