implements PLN-0087
This commit is contained in:
parent
6cb0918715
commit
51f6a36b1d
@ -661,9 +661,7 @@ impl Gfx {
|
|||||||
self.load_frame_sprites(&sprites);
|
self.load_frame_sprites(&sprites);
|
||||||
self.render_no_scene_frame();
|
self.render_no_scene_frame();
|
||||||
|
|
||||||
for command in &packet.gfx2d {
|
self.apply_gfx2d_commands(&packet.gfx2d);
|
||||||
self.apply_gfx2d_command(command);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render_shell_ui_frame_packet(&mut self, packet: &ShellUiFramePacket) {
|
pub fn render_shell_ui_frame_packet(&mut self, packet: &ShellUiFramePacket) {
|
||||||
@ -672,6 +670,12 @@ impl Gfx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn apply_gfx2d_commands(&mut self, commands: &[Gfx2dCommand]) {
|
||||||
|
for command in commands {
|
||||||
|
self.apply_gfx2d_command(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn apply_gfx2d_command(&mut self, command: &Gfx2dCommand) {
|
fn apply_gfx2d_command(&mut self, command: &Gfx2dCommand) {
|
||||||
match command {
|
match command {
|
||||||
Gfx2dCommand::Clear { color } => self.clear(*color),
|
Gfx2dCommand::Clear { color } => self.clear(*color),
|
||||||
|
|||||||
@ -79,6 +79,7 @@ impl HardwareBridge for Hardware {
|
|||||||
self.gfx.render_game2d_frame_packet(packet);
|
self.gfx.render_game2d_frame_packet(packet);
|
||||||
} else {
|
} else {
|
||||||
self.frame_composer.render_frame(&mut self.gfx);
|
self.frame_composer.render_frame(&mut self.gfx);
|
||||||
|
self.gfx.apply_gfx2d_commands(&packet.gfx2d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RenderSubmissionPacket::ShellUi(packet) => {
|
RenderSubmissionPacket::ShellUi(packet) => {
|
||||||
@ -187,12 +188,14 @@ mod tests {
|
|||||||
use prometeu_hal::color::Color;
|
use prometeu_hal::color::Color;
|
||||||
use prometeu_hal::glyph::Glyph;
|
use prometeu_hal::glyph::Glyph;
|
||||||
use prometeu_hal::glyph_bank::{GlyphBank, TileSize};
|
use prometeu_hal::glyph_bank::{GlyphBank, TileSize};
|
||||||
|
use prometeu_hal::primitives::Rect;
|
||||||
use prometeu_hal::scene_bank::SceneBank;
|
use prometeu_hal::scene_bank::SceneBank;
|
||||||
use prometeu_hal::scene_layer::{ParallaxFactor, SceneLayer};
|
use prometeu_hal::scene_layer::{ParallaxFactor, SceneLayer};
|
||||||
use prometeu_hal::scene_viewport_cache::SceneViewportCache;
|
use prometeu_hal::scene_viewport_cache::SceneViewportCache;
|
||||||
use prometeu_hal::scene_viewport_resolver::SceneViewportResolver;
|
use prometeu_hal::scene_viewport_resolver::SceneViewportResolver;
|
||||||
use prometeu_hal::tile::Tile;
|
use prometeu_hal::tile::Tile;
|
||||||
use prometeu_hal::tilemap::TileMap;
|
use prometeu_hal::tilemap::TileMap;
|
||||||
|
use prometeu_hal::{FrameId, Gfx2dCommand};
|
||||||
|
|
||||||
fn make_glyph_bank() -> GlyphBank {
|
fn make_glyph_bank() -> GlyphBank {
|
||||||
let mut bank = GlyphBank::new(TileSize::Size8, 8, 8);
|
let mut bank = GlyphBank::new(TileSize::Size8, 8, 8);
|
||||||
@ -204,9 +207,13 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn make_scene() -> SceneBank {
|
fn make_scene() -> SceneBank {
|
||||||
|
make_scene_with_glyph_asset_id(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_scene_with_glyph_asset_id(glyph_asset_id: i32) -> SceneBank {
|
||||||
let layer = SceneLayer {
|
let layer = SceneLayer {
|
||||||
active: true,
|
active: true,
|
||||||
glyph_asset_id: 1,
|
glyph_asset_id,
|
||||||
tile_size: TileSize::Size8,
|
tile_size: TileSize::Size8,
|
||||||
parallax_factor: ParallaxFactor { x: 1.0, y: 1.0 },
|
parallax_factor: ParallaxFactor { x: 1.0, y: 1.0 },
|
||||||
tilemap: TileMap {
|
tilemap: TileMap {
|
||||||
@ -231,7 +238,7 @@ mod tests {
|
|||||||
fn hardware_can_render_scene_from_shared_scene_bank_pipeline() {
|
fn hardware_can_render_scene_from_shared_scene_bank_pipeline() {
|
||||||
let banks = Arc::new(MemoryBanks::new());
|
let banks = Arc::new(MemoryBanks::new());
|
||||||
banks.install_glyph_bank(0, Arc::new(make_glyph_bank()));
|
banks.install_glyph_bank(0, Arc::new(make_glyph_bank()));
|
||||||
banks.install_scene_bank(0, Arc::new(make_scene()));
|
banks.install_scene_bank(0, Arc::new(make_scene_with_glyph_asset_id(0)));
|
||||||
|
|
||||||
let mut hardware = Hardware::new_with_memory_banks(Arc::clone(&banks));
|
let mut hardware = Hardware::new_with_memory_banks(Arc::clone(&banks));
|
||||||
let scene = banks.scene_bank_slot(0).expect("scene bank slot 0 should be resident");
|
let scene = banks.scene_bank_slot(0).expect("scene bank slot 0 should be resident");
|
||||||
@ -262,4 +269,27 @@ mod tests {
|
|||||||
assert_eq!(hardware.frame_composer.scene_bank_slot_count(), 16);
|
assert_eq!(hardware.frame_composer.scene_bank_slot_count(), 16);
|
||||||
assert_eq!(scene.layers[0].tile_size, TileSize::Size8);
|
assert_eq!(scene.layers[0].tile_size, TileSize::Size8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn publish_game2d_submission_applies_gfx2d_overlay_after_active_scene() {
|
||||||
|
let banks = Arc::new(MemoryBanks::new());
|
||||||
|
banks.install_glyph_bank(0, Arc::new(make_glyph_bank()));
|
||||||
|
banks.install_scene_bank(0, Arc::new(make_scene_with_glyph_asset_id(0)));
|
||||||
|
|
||||||
|
let mut hardware = Hardware::new_with_memory_banks(banks);
|
||||||
|
let mut glyph_slots = [None; 16];
|
||||||
|
glyph_slots[0] = Some(0);
|
||||||
|
hardware.assets.glyph_asset_slot_index().rebuild_from_slots(&glyph_slots);
|
||||||
|
assert!(hardware.bind_scene(0));
|
||||||
|
|
||||||
|
let mut packet = hardware.close_game2d_packet();
|
||||||
|
packet.gfx2d = vec![Gfx2dCommand::FillRect {
|
||||||
|
rect: Rect { x: 0, y: 0, w: 1, h: 1 },
|
||||||
|
color: Color::BLUE,
|
||||||
|
}];
|
||||||
|
|
||||||
|
hardware.publish_render_submission(&RenderSubmission::game2d(FrameId::ZERO, packet));
|
||||||
|
|
||||||
|
assert_eq!(hardware.gfx.front_buffer()[0], Color::BLUE.raw());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{"type":"meta","next_id":{"DSC":42,"AGD":42,"DEC":32,"PLN":98,"LSN":48,"CLSN":1}}
|
{"type":"meta","next_id":{"DSC":42,"AGD":42,"DEC":32,"PLN":98,"LSN":48,"CLSN":1}}
|
||||||
{"type":"discussion","id":"DSC-0039","status":"abandoned","ticket":"render-pipeline-family-and-future-3d","title":"Render Pipeline Family and Future 3D","created_at":"2026-06-04","updated_at":"2026-06-04","tags":["gfx","renderer","runtime","architecture","pipeline"],"agendas":[{"id":"AGD-0039","file":"AGD-0039-render-pipeline-family-and-future-3d.md","status":"abandoned","created_at":"2026-06-04","updated_at":"2026-06-04","_override_reason":"User explicitly chose to close this agenda without a new decision because DSC-0038 already established enough architecture for future extension, and 3D is intentionally deferred."}],"decisions":[],"plans":[],"lessons":[],"_override_reason":"User explicitly chose to close this agenda without a new decision because DSC-0038 already established enough architecture for future extension, and 3D is intentionally deferred."}
|
{"type":"discussion","id":"DSC-0039","status":"abandoned","ticket":"render-pipeline-family-and-future-3d","title":"Render Pipeline Family and Future 3D","created_at":"2026-06-04","updated_at":"2026-06-04","tags":["gfx","renderer","runtime","architecture","pipeline"],"agendas":[{"id":"AGD-0039","file":"AGD-0039-render-pipeline-family-and-future-3d.md","status":"abandoned","created_at":"2026-06-04","updated_at":"2026-06-04","_override_reason":"User explicitly chose to close this agenda without a new decision because DSC-0038 already established enough architecture for future extension, and 3D is intentionally deferred."}],"decisions":[],"plans":[],"lessons":[],"_override_reason":"User explicitly chose to close this agenda without a new decision because DSC-0038 already established enough architecture for future extension, and 3D is intentionally deferred."}
|
||||||
{"type":"discussion","id":"DSC-0040","status":"in_progress","ticket":"vm-render-parallel-execution-boundary","title":"VM and Render Parallel Execution Boundary","created_at":"2026-06-04","updated_at":"2026-06-05","tags":["runtime","renderer","vm","concurrency","architecture","perf"],"agendas":[{"id":"AGD-0040","file":"AGD-0040-vm-and-render-parallel-execution-boundary.md","status":"accepted","created_at":"2026-06-04","updated_at":"2026-06-05"}],"decisions":[{"id":"DEC-0031","file":"DEC-0031-vm-and-render-parallel-execution-boundary.md","status":"accepted","created_at":"2026-06-05","updated_at":"2026-06-05","ref_agenda":"AGD-0040"}],"plans":[{"id":"PLN-0087","file":"PLN-0087-fix-game2d-packet-overlay-composition.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0088","file":"PLN-0088-define-read-only-render-resource-boundary.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0089","file":"PLN-0089-introduce-render-handoff-abstraction.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0090","file":"PLN-0090-add-render-frame-pacing-contract.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0091","file":"PLN-0091-implement-appmode-render-policy-matrix.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0092","file":"PLN-0092-add-render-epoch-ownership-transitions.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0093","file":"PLN-0093-add-render-telemetry-counters-and-events.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0094","file":"PLN-0094-specify-async-render-boundary.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0095","file":"PLN-0095-prototype-local-render-worker-capability.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0096","file":"PLN-0096-define-render-shutdown-and-failure-handling.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0097","file":"PLN-0097-add-async-render-integration-test-matrix.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]}],"lessons":[]}
|
{"type":"discussion","id":"DSC-0040","status":"in_progress","ticket":"vm-render-parallel-execution-boundary","title":"VM and Render Parallel Execution Boundary","created_at":"2026-06-04","updated_at":"2026-06-05","tags":["runtime","renderer","vm","concurrency","architecture","perf"],"agendas":[{"id":"AGD-0040","file":"AGD-0040-vm-and-render-parallel-execution-boundary.md","status":"accepted","created_at":"2026-06-04","updated_at":"2026-06-05"}],"decisions":[{"id":"DEC-0031","file":"DEC-0031-vm-and-render-parallel-execution-boundary.md","status":"accepted","created_at":"2026-06-05","updated_at":"2026-06-05","ref_agenda":"AGD-0040"}],"plans":[{"id":"PLN-0087","file":"PLN-0087-fix-game2d-packet-overlay-composition.md","status":"done","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0088","file":"PLN-0088-define-read-only-render-resource-boundary.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0089","file":"PLN-0089-introduce-render-handoff-abstraction.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0090","file":"PLN-0090-add-render-frame-pacing-contract.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0091","file":"PLN-0091-implement-appmode-render-policy-matrix.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0092","file":"PLN-0092-add-render-epoch-ownership-transitions.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0093","file":"PLN-0093-add-render-telemetry-counters-and-events.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0094","file":"PLN-0094-specify-async-render-boundary.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0095","file":"PLN-0095-prototype-local-render-worker-capability.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0096","file":"PLN-0096-define-render-shutdown-and-failure-handling.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]},{"id":"PLN-0097","file":"PLN-0097-add-async-render-integration-test-matrix.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05","ref_decisions":["DEC-0031"]}],"lessons":[]}
|
||||||
{"type":"discussion","id":"DSC-0041","status":"open","ticket":"foreground-stack-game-pause-shell-vm-backed","title":"Foreground Stack, Game Pause, and VM-Backed Shell Coexistence","created_at":"2026-06-05","updated_at":"2026-06-05","tags":["runtime","os","lifecycle","shell","game","vm","foreground","architecture"],"agendas":[{"id":"AGD-0041","file":"AGD-0041-foreground-stack-game-pause-shell-vm-backed.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05"}],"decisions":[],"plans":[],"lessons":[]}
|
{"type":"discussion","id":"DSC-0041","status":"open","ticket":"foreground-stack-game-pause-shell-vm-backed","title":"Foreground Stack, Game Pause, and VM-Backed Shell Coexistence","created_at":"2026-06-05","updated_at":"2026-06-05","tags":["runtime","os","lifecycle","shell","game","vm","foreground","architecture"],"agendas":[{"id":"AGD-0041","file":"AGD-0041-foreground-stack-game-pause-shell-vm-backed.md","status":"open","created_at":"2026-06-05","updated_at":"2026-06-05"}],"decisions":[],"plans":[],"lessons":[]}
|
||||||
{"type":"discussion","id":"DSC-0038","status":"done","ticket":"render-frame-packet-boundary","title":"Logical Render Pipelines and Command Packets","created_at":"2026-05-25","updated_at":"2026-06-04","tags":["gfx","renderer","runtime","frame-composer","architecture","ui","pipeline"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0047","file":"discussion/lessons/DSC-0038-render-frame-packet-boundary/LSN-0047-typed-render-submissions-preserve-domain-boundaries.md","status":"done","created_at":"2026-06-04","updated_at":"2026-06-04"}]}
|
{"type":"discussion","id":"DSC-0038","status":"done","ticket":"render-frame-packet-boundary","title":"Logical Render Pipelines and Command Packets","created_at":"2026-05-25","updated_at":"2026-06-04","tags":["gfx","renderer","runtime","frame-composer","architecture","ui","pipeline"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0047","file":"discussion/lessons/DSC-0038-render-frame-packet-boundary/LSN-0047-typed-render-submissions-preserve-domain-boundaries.md","status":"done","created_at":"2026-06-04","updated_at":"2026-06-04"}]}
|
||||||
{"type":"discussion","id":"DSC-0035","status":"done","ticket":"task-owned-shell-windows","title":"Agenda - Task-Owned Shell Windows","created_at":"2026-05-15","updated_at":"2026-05-15","tags":["runtime","os","task","window-manager","shell","lifecycle"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0044","file":"discussion/lessons/DSC-0035-task-owned-shell-windows/LSN-0044-task-window-liveness-belongs-to-the-task.md","status":"done","created_at":"2026-05-15","updated_at":"2026-05-15"}]}
|
{"type":"discussion","id":"DSC-0035","status":"done","ticket":"task-owned-shell-windows","title":"Agenda - Task-Owned Shell Windows","created_at":"2026-05-15","updated_at":"2026-05-15","tags":["runtime","os","task","window-manager","shell","lifecycle"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0044","file":"discussion/lessons/DSC-0035-task-owned-shell-windows/LSN-0044-task-window-liveness-belongs-to-the-task.md","status":"done","created_at":"2026-05-15","updated_at":"2026-05-15"}]}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
id: PLN-0087
|
id: PLN-0087
|
||||||
ticket: vm-render-parallel-execution-boundary
|
ticket: vm-render-parallel-execution-boundary
|
||||||
title: Fix Game2D Packet Overlay Composition
|
title: Fix Game2D Packet Overlay Composition
|
||||||
status: open
|
status: done
|
||||||
created: 2026-06-05
|
created: 2026-06-05
|
||||||
ref_decisions: [DEC-0031]
|
ref_decisions: [DEC-0031]
|
||||||
tags: [runtime, renderer, game2d, packet, overlay]
|
tags: [runtime, renderer, game2d, packet, overlay]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user