implements PLN-0082 render publication boundary

This commit is contained in:
2026-05-25 14:18:40 +01:00
parent 74df4b89ac
commit 41266d3fd5
11 changed files with 54 additions and 35 deletions
@@ -1,7 +1,9 @@
use crate::{CrashReport, SystemOS};
use prometeu_hal::color::Color;
use prometeu_hal::primitives::Rect;
use prometeu_hal::{GfxUiCommand, HardwareBridge, InputSignals, ShellUiFramePacket};
use prometeu_hal::{
FrameId, GfxUiCommand, HardwareBridge, InputSignals, RenderSubmission, ShellUiFramePacket,
};
use prometeu_vm::VirtualMachine;
const SHELL_A_BUTTON: Rect = Rect { x: 112, y: 108, w: 112, h: 48 };
@@ -140,7 +142,7 @@ impl PrometeuHub {
}
ShellUiFramePacket::new(commands)
};
hw.render_shell_ui_packet(&packet);
hw.publish_render_submission(&RenderSubmission::shell_ui(FrameId::ZERO, packet));
}
pub fn update_shell_profile(
@@ -162,7 +164,6 @@ impl PrometeuHub {
}
self.render(os, hw);
hw.present();
SystemProfileUpdate { crash, action }
}
@@ -653,7 +653,6 @@ fn tick_renders_bound_eight_pixel_scene_through_frame_composer_path() {
);
assert!(report.is_none(), "frame render path must not crash");
hardware.gfx.present();
assert_eq!(hardware.gfx.front_buffer()[0], Color::BLUE.raw());
}
@@ -729,7 +728,6 @@ fn tick_renders_scene_through_public_composer_syscalls() {
assert!(report.is_none(), "public composer path must not crash");
assert_eq!(vm.operand_stack_top(1), vec![Value::Int64(ComposerOpStatus::Ok as i64)]);
hardware.gfx.present();
assert_eq!(hardware.gfx.front_buffer()[0], Color::BLUE.raw());
}
@@ -785,7 +783,6 @@ fn tick_draw_text_survives_no_scene_frame_path() {
};
assert_eq!(packet.gfx2d.len(), 1);
assert!(matches!(packet.gfx2d[0], prometeu_hal::Gfx2dCommand::DrawText { .. }));
hardware.gfx.present();
assert_eq!(hardware.gfx.front_buffer()[0], Color::from_raw(0x11223344).raw());
}
@@ -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(