fix(runtime): bound camera resolver work and handle extreme coordinates
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good

Preserve camera hysteresis with constant-time wide arithmetic, refresh nonoverlapping cache jumps, and clip wide offsets before drawing. Add guest pixel-oracle and resource/snapshot regressions and document the contract.

Validated by the complete tooling verify run 20261126T113331Z-1d071c1d (all 11 stages passed), plus focused debug/release tests. Work: WRK-0020.
This commit is contained in:
2026-11-26 11:47:32 +00:00
parent 7fd6fef1c8
commit 0d20194aa2
6 changed files with 1020 additions and 103 deletions
+9 -7
View File
@@ -770,16 +770,16 @@ impl Gfx {
);
};
let tile_size_px = request.tile_size as i32;
let tile_size_px = request.tile_size as i64;
for cache_y in 0..layer_cache.height() {
let screen_tile_y = cache_y as i32 * tile_size_px - request.source_offset_y_px;
if screen_tile_y >= screen_h as i32 || screen_tile_y + tile_size_px <= 0 {
let screen_tile_y = cache_y as i64 * tile_size_px - request.source_offset_y_px;
if screen_tile_y >= screen_h as i64 || screen_tile_y + tile_size_px <= 0 {
continue;
}
for cache_x in 0..layer_cache.width() {
let screen_tile_x = cache_x as i32 * tile_size_px - request.source_offset_x_px;
if screen_tile_x >= screen_w as i32 || screen_tile_x + tile_size_px <= 0 {
let screen_tile_x = cache_x as i64 * tile_size_px - request.source_offset_x_px;
if screen_tile_x >= screen_w as i64 || screen_tile_x + tile_size_px <= 0 {
continue;
}
@@ -791,8 +791,10 @@ impl Gfx {
Self::draw_cached_tile_pixels(
&mut target,
CachedTileDraw {
x: screen_tile_x,
y: screen_tile_y,
// Culling leaves -tile_size < local < screen extent;
// only these small local coordinates enter the pixel loop.
x: i32::try_from(screen_tile_x).expect("visible tile x must fit Int32"),
y: i32::try_from(screen_tile_y).expect("visible tile y must fit Int32"),
entry,
bank: &bank,
tile_size: request.tile_size,