A movie picture decoded as a texture is rounded up to powers of two: a
640 x 448 picture in a 1024 x 512 texture. setBackdrop mapped the whole
texture to its rectangle, so a port had to draw it larger than the
picture and let the window cut the padding off. Where the window does not
(a 4:3 picture kept 4:3 in a widescreen frame, or a letterbox), the
padding showed: Amplitude's widescreen movies had a strip of stale
pictures at the right and below.
Two trailing parameters (u, v) give the part that is the picture; their
defaults (1, 1) keep every port's call as it was.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A port that makes its draws' vertices itself (Shinobido's GS translator: 30,000
primitives a frame) built them in its own batches and draw() copied every one into the
frame being built at the flip. Now it can make them straight into that frame:
appendVertices gives room at its end, drawRange adds a batch over vertices already there
(two batches may share a range, as a two-pass draw's do), and continueFrame starts the
frame like beginFrame but keeps the vertices appended since the last one ended. draw() is
append + drawRange (a refused batch keeps none of its vertices).
tests/render/draw_in_place_tests.cpp: the same frame digest as draw()'s copies, shared
ranges, a range past the vertices refused, beginFrame dropping what was appended.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Material::depthOffsetSlope / depthOffsetUnits (glPolygonOffset, toward the camera): with anti-aliasing a
target sharing the frame's depth gets the depth resolved from one sample point off each pixel's centre,
which on a steep surface can lie nearer than a decal's centre depth, so marks laid at the surface's own
depth all failed (Dark Cloud's character shadows vanished at 4x). 0, 0 (the default) draws as before.
native_render_targets: a decal on a steep slope through a shared-depth target lands with no
anti-aliasing (with and without the offset) and, with the offset, at 4x and 8x. Without the offset at
4x every mark failed (checked, not kept as a case: which sample the resolve takes is the driver's).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A draw whose texture holds a 24-bit GS Z per texel (R, G, B its low,
middle and high bytes) writes that Z as its depth, through a small
program of its own (the main one keeps its early depth test), on the
vertex shader's mapping (window depth 1 - Z / depthMax). A port loads a
pre-rendered scene's depth this way before its 3D: Onimusha's rooms
upload their cut's Z buffer (PSMZ24) each frame for the models' ZTST.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Material::lines makes a frame draw's vertices segment pairs (the GS's
LINE / LINE STRIP, one pixel wide) instead of triangles. An odd count,
image processing or an overlay batch rejects; the flag is hashed only when
set. VP2S: the forest minimap's outlines. An admission/digest check and a
GPU row check.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ImageProcessing::depthColours reads depthWeights as 64 RGBA entries (alpha
1.0 = the GS's 0x80), the index clamped to 63, replacing the texel. With
Blend::DestinationBySource this is a port's depth fog: a ramp colour added
and the scene scaled by the ramp's alpha (VP2S: the Lost Forest haze).
Hashed only when set, so existing frame digests are unchanged. Two
admission guards, a digest check and a GPU case.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- WindowOptions::hidden (never shown) and captureScene (also PS2X_CAPTURE_SCENE=1): the window presents
into an offscreen picture, captures read it, then it is copied to the window. A hidden or covered
window's back buffer read back black, so captures depended on what was on top of the desktop.
- Renderer::present returns to the framebuffer it was called with instead of 0.
- gl: BlitFramebuffer.
- Material::stencilDepthFail: stencilOp counts where the depth test fails (z-fail), for closed volumes
the near plane cuts or the camera is in.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A blur drawn as GS sprites (a base copy, then lerps C = floor((S - C) * a / 128) + C at
1/16-texel offsets) truncates at every step in 8-bit integers, so no linear kernel gives the
same image: for VP2's glow the float kernel was about twice as bright as the game's. The
chain mode does the same integer steps in the shader: base texel modulated by chainColour,
each tap bilinear with 4-bit weights, edges clamped, modulated, floored, lerped.
Tests: the GPU result equals a CPU reference of the same steps; four new admission guards.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A per-draw flag: the draw's auxiliary target tests and writes the main frame's
depth buffer instead of its own, as a GS draw into another frame address with
the same ZBUF would. VP2S's multi-copy depth blur needs it to compare depth
planes with the scene into a marker image without touching the frame's alpha,
which here is the presentation's coverage. The global shared-depth bits are
read when the frame executes, so they cannot be toggled around one draw.
The image takes the main frame's dimensions; a frame-depth draw without an
auxiliary target is rejected. The draw digest includes the flag only when set.
The GPU image test covers a plane between two scene depths, an unchanged main
depth (no write), and a later ordinary draw that has its own depth again.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Interpolate vertex colour in screen space while retaining perspective texture coordinates. Add opt-in display RGB and fragment atlas bounds, include active material extensions in draw digests, and cover varying-depth colour interpolation with GPU readback.
Material::mipmap (levels, filter within and between levels, LOD from the
screen footprint, from the GS's Q with K and L, or fixed) and mipmapOf(tex1)
for the GS's TEX1. Texture::levels carries a port's own levels; without them
the renderer makes the chain from level 0 at upload. levels 0 samples level 0
as before; the draw digest folds the mipmap and a texture's levels only when
set, so existing references keep their hashes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Default Modulate with the texel's alpha, as before; the digest folds them only when set, so references keep their hashes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each game frame was built in fresh vectors (the previous frame's moved into the published one): a busy frame's
vertices, several MB, grew by doubling and touched new pages every frame, and were freed by whichever thread let go
last (Renderer::draw was 2.8% of the game thread, against the fork's 0.2%). Frames now come back to a small pool when
their last holder lets go. noteDrawList hashed every vertex of every frame for the record's `draws` field: the free
host turns it off when it writes no record (Renderer::setDrawDigest); the call-log checks keep it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
TMB_Recomp's runtime builds on BozoEngine (its branch bozo/m0, cmake -DTMB_BOZO=ON): its overrides run natively, each
call checked against the reference's log (tmb-check), and with no log at all (tmb-headless).
- Port API (runtime/include/bozo/port.h, bozo_port): Registry::registerFunction, BOZO_PORT, the startup check that
every registered override is an external of the generated code (port::undeclared), and what overrides use: the
kernel (changePriority, rotateReadyQueue, transfer), the EE clock (now, accountCycles), vblankCount, the hardware
registers (ioRead32 / ioWrite32: a port's own access), frameEnd, callLibrary, scratchpad, libraries, deterministic,
realTime, setStorePatch. A port::Host is behind them.
- Overrides that run guest code (kernel.md section 3b): checkpoints charge, no event is taken in place; an event due,
a call that blocks, a jump through a register, an inner call's return and a recursive call's return make guest code
leave the override there, the stop deferred to its end (Dispatcher::beginOutcall / leave / takeDeferredStop); the
override's own code runs on, as the reference's did; no exception goes through it. Every rule settled on a record.
- Generated code: bozo::checkpoint and bozo::innerReturn return true when guest code leaves, the check after each
call tests ctx->leaving, a recursive call's return inside an override calls bozo_leave; ctx->outcall,
ctx->leaving; the externals table (<prefix>_external_table); "store 0xADDR" externals (the store sets ctx->pc first).
- bozo-externals (tools/externals): the --externals list from the ELF's symbols BozoEngine answers, a port's stub names
and its override list; --check compares the stubs with a call log's.
- bozo-run as a library (bozo_run, run_main.h): a port's checker links it with its generated code and overrides,
which run natively (--overrides native|log); LogHost checks each call (context words, memory runs, traced calls, the
operations and frame end inside, where it left) and pins where the reference's override left and whether a timed
call inside it waited. The renderer's draw lists fill the record's draws (reported).
- The free host (runtime/host/free_host.cpp, bozo_host): every out-call native, libraries bound by the ELF's symbols,
free timing, a watchdog when no frame ends.
- Moved from the team's fork code (phase4-inventory.md 2.1, MIT headers): the renderer's game side
(bozo/render/renderer.h, renderer.cpp: headless, recording the published lists and their hash), Texture,
the texture and mesh packs, mesh_draw, the movie picture hook, the FramePacer (unpaced off real time) and
determinism.h (settable by the host).
- Libraries, from what only ran inside overrides before: sceGsExecLoadImage (0, no upload), T8H/T4HL/T4HH image tags as
32-bit texels, the GS CSR's FIELD, sceSifSetDma raising SIF0's DMAC interrupt, CPCOND0 counting completions from
the last FlushCache, a port's own register accesses, RotateThreadReadyQueue returning 0, libmpeg calling the movie
picture hook, PadState::multitap.
- BOZO_BUILD_TOOLS (zlib-free configure for a port), the tests only when top level.
Results: TMB boot --pinned with every override native, 3000 of 3000 frames and 4,650,558 of 4,650,558 records (ram,
scratchpad, calls, threads); match1p: see docs/phase4-m0-notes.md. bozo-run without a port still matches.
Co-Authored-By: Claude Opus 5.5 <[email protected]>