The CPU rasteriser takes the nearest texel whatever SET_TEXTURE_FILTER
asked for, so a floor or wall seen at a slant aliases and shimmers.
RECOMP_TEX_BILINEAR=1 blends the four nearest texels of every textured
pixel. RECOMP_TEX_ANISO=8 or 16 takes up to that many bilinear taps along
the longer of the pixel's two texel gradients and implies bilinear; any
other value leaves it off. Both are off by default and read once per
process, so with neither set every title draws exactly as before.
All three sampling paths take them:
- raster_triangle (pixel-position batches): the gradients are constant over
a triangle, so the footprint is worked out once per triangle.
- the perspective path without combiners (xf_rows): the gradient is the
coordinate one pixel right and one pixel down minus the coordinate here,
so it stays perspective-correct. XfTri gains dl[3][2], the barycentric
step per pixel, to evaluate them.
- the register-combiner stages (rc_texel, rc_stage_fetch): the same
neighbour coordinates. rc_texel's existing tent blend moves into rc_tent
so the title's own tent request and the aniso taps share it.
No mip levels: a minified texture is averaged along its stretched axis
only. GPU back ends have their own filtering and are not affected.
Test: tests/nv2a_tex_filter, one process per mode (nearest, bilinear,
aniso8, aniso16) on each of the three paths, 12 CTest cases. A two-texel
ramp checks the blend; a stripe texture of three texels to a pixel checks
that anisotropic taps average where nearest and bilinear alias.
Verified: all 12 pass on Windows (MSVC, VS 18) and Linux x86-64 (gcc 15);
nv2a_raster_batch, nv2a_ffp_backend, nv2a_combiner and nv2a_vsh pass. Built
against the unchanged nv2a_pb_exec.c, the three nearest cases pass and the
nine filtered ones fail. Each path was also broken in turn to confirm that
exactly its cases fail. The default-mode output of the test is
byte-identical before and after on all three paths.
Blast radius: nv2a_pb_exec.c only. With both switches unset the nearest
texel path is unchanged; the added work is a read of two cached ints per
texel (rc_texel), per xf_rows call and per triangle, and six multiplies per
triangle for XfTri.dl. Measured on a synthetic 64x64 textured-quad loop,
that was +2.5% on the pixel-position path, +2.3% on the perspective path
and within noise on the combiner path. With a switch set, 8 and 16 taps
cost several times the nearest path.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
docs/INDEX.md stays the one index. Every page gets one navigation line under
its title that points back to it, and runtime/ gets a reference page for the
environment variables.
docs/runtime/environment-variables.md lists every RECOMP_* switch the runtime
and tools read: its default, its effect and the source file that reads it,
grouped as bring-up, kernel, pushbuffer executor, video, audio and input.
Fifty-one of them were not in the docs at all. docs/INDEX.md links it from
"Start Here".
No page is renamed, moved or rewritten, and no other index is added.
Checked: every RECOMP_* name read by getenv, env_on, apu_env_on, env_int or
xa2_env_int in src/, tools/, templates/ and include/ is on the page, and
every name on the page is in the source. All relative links in docs/ resolve
(0 broken, as at v0.16.0). The 34 existing pages change by insertion only:
68 lines added, none removed. docs/INDEX.md gains one line.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The executor expands a triangle strip as (i, i+1, i+2) for every i, so
every odd triangle winds the opposite way to its neighbour. A strip on
hardware keeps one winding by taking the first two vertices of each odd
triangle swapped. A back end that culls from the render state's cull
registers, or lights two-sided from the winding, therefore drops or
back-lights every second triangle of every strip.
Opt-in, off by default: with RECOMP_STRIP_ALT_WINDING unset the strip order
is unchanged and no title's output moves. Both strip expansions read it
(the transform path and the screen-space indexed path).
Test: tests/nv2a_ffp_backend draws a four-vertex strip and checks the
second triangle's vertex order, run once without the switch (1 2 3) and
once with it (2 1 3). With the switch forced off in the source the second
run fails; with it working both pass.
Verified: nv2a_ffp_backend (2 tests), nv2a_pb_walk, nv2a_raster_batch,
nv2a_vsh and nv2a_combiner pass on Windows (MSVC);
nv2a_ffp_backend passes on Linux x86-64 (gcc).
Blast radius: the strip cases of the two expansion switches in
nv2a_pb_exec.c, behind the switch.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Review of #162 (round 2):
- The walk stops at PUT inside a method's parameters and finishes the
same method when PUT moves, as the DMA engine does. It no longer runs
on through stale ring contents, and it no longer reads the leftover
parameters as headers (D3D streams large inline arrays across kicks).
A CALL inside a CALL stops the walk instead of overwriting the return
address.
- fetch_attr checks every vertex read against guest memory, so a garbage
32-bit index drops the batch instead of reading past guest RAM. Surface
writes are refused outside guest memory and on the thread stacks, as
they already were on the image.
- 2x2 anti-aliasing: the framebuffer window takes every other row
(xbox_FramebufferWindowSetAA), and the screen-space fallback scales its
vertices like the clip rect.
- s_xf and s_bverts are allocated on first use (about 13 MB).
- Tests: PUT inside a method, nested CALL and self-jump in nv2a_pb_walk;
a garbage index, lighting below the clamp with an attenuated local
light, and the 0x0310 latch in nv2a_ffp_backend.
- Docs: the back-end advice is marked as coming from a back end not in
this tree.
The Burnout 3 run: with RECOMP_PB_EXEC=1 the DMA walk froze it at the
Crash Nav menu and in the garage, where v0.13.0 runs. A freeze report put
the main thread in KeWaitForSingleObject under D3D's fence wait: told
exactly how far the GPU has got, D3D patches a software method into the
pushbuffer and sleeps on the event the GPU's interrupt for it would set,
and this runtime does not deliver that interrupt. The walk commit alone
reproduces it. So the walk is now opt-in, RECOMP_PB_WALK=dma, and the
default is the segment scan v0.13.0 used, with 0x0310 unmodelled as
before. In the default mode Burnout 3 runs Crash Nav and loads the car,
with no faults. Under the walk, a project that mirrors its fence
(xbox_Nv2aMirrorFence) gets a 0x0310 latch whose fence bits match the
mirrored word.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pushbuffer-executor.md covers what sits around the v0.13.0 rasteriser: the
DMA-engine walk, answering the title while it runs, fixed-function transform
and lighting, anti-aliased surfaces, index width and the back-end interface.
d3d8ltcg-device-context.md gains the semaphore hand-off for a title whose fence
wait is replaced while the executor runs, and the PGRAPH 0x400B10 wait.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>