Commit Graph

18350 Commits

Author SHA1 Message Date
c95183fd8f Merge pull request #2229 from Tauwni/docs/kk-nan-constant-fixtures
docs/testing.md: three more KosmicKrisp failures from its (NAN) constant printing
2026-12-01 13:45:44 +01:00
457735ca8a docs: fix stale repo references and add coding-agent engineering bar 2026-12-01 07:44:31 -05:00
2d4f316b04 Merge pull request #351 from kotekompotek/work/test-hw-oracle-asm
test: unit tests for tools/hw_oracle/asm.py
2026-12-01 13:39:35 +01:00
8a72e40d87 Merge remote-tracking branch 'origin/main' into tools/cgroup-memory-peak 2026-12-01 13:22:50 +01:00
6c7f6b60cf Merge pull request #2870 from MoonEyes/fix/chain-check-slow-line
chain_check: read the slow compute pipeline line as the runtime prints it now (TOOLS-CHAIN-CHECK-SLOW-LINE)
2026-12-01 13:21:59 +01:00
8ceb5ef4b3 chain_check: read the slow compute pipeline line as the runtime prints it now
The line says where the pipeline came from since 7acf84d38, so the pin in
tests/test_chain_check.py failed on main. Only a compile counts as a build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 13:09:06 +01:00
c60ce461af Merge pull request #2334 from kirigayakazima/fix/merge-check-safety
merge_check: guard ref option injection, bounds, and git timeouts
2026-12-01 12:57:50 +01:00
8275269bdc Merge pull request #656 from kirigayakazima/fix/rpf9dump-segments-and-cli
rpf9dump: harden segment bounds and CLI option validation (RPF9DUMP-SEGMENTS-AND-CLI)
2026-12-01 12:57:36 +01:00
abf475ef65 Merge remote-tracking branch 'origin/main' into tools/cgroup-memory-peak
# Conflicts:
#	tests/test_run_game_wine.py
2026-12-01 12:55:58 +01:00
8497337b4e Merge pull request #2145 from fiestorra/awc-skip-existing
tools: skip Ogg Opus outputs that already exist, so a stopped audio export resumes
2026-12-01 12:53:42 +01:00
3fbc120df4 Merge pull request #1397 from whoalin1/mask-regs-data-read
rdna2spirv: a VALU data read of a lane-mask operand yields the wave's mask word
2026-12-01 12:53:35 +01:00
b0306ef421 The light stand-in can let near surfaces take its estimate, not stale probe tiles (LEONIDA_AMBIENT_NEAR, off)
Without ray tracing the title's probe resolve leaves stale tiles of 16x16 where its probes found nothing,
and the light pass's last step kept the larger of those and its own estimate: a mosaic on faces and hair.
With `LEONIDA_AMBIENT_NEAR=1` near surfaces take the estimate, and past 100 m what was there comes back,
fully by 250 m, for the sky's light. After DoubleGhosty/cool_fox b0906d4 (NoLogicAlan's fix of its issue
#151, GPL-3.0), without that commit's other clamps (Leonida's passes cap what was there by the estimate
already). Off by default until a recorded tour shows faces and hair with and without it.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: type-checked; tours with and without it
to follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 06:52:30 -05:00
d905b003ca On NVIDIA cards, max/min/med3 and the legacy product in the card's own forms, checked to the bit on the card
Ported from KyleS98/VIctory-Neo e23accf, itself from readmet3xt-lab/foxhound 9b11fac5 ("Shaders on
NVIDIA: max/min/med3 and the legacy product in exact host forms", VICTORY_HOST_FLOAT), GPL-3.0, as
Leonida code.

The console's v_max/v_min (which order -0 below +0), v_med3 between two constants and the legacy
product (0 times anything is 0) were spelled out for every host but AMD's RDNA cards, in four to seven
operations each. On an NVIDIA host (`set_host_nvidia`, from the device's vendor) they are now the host's
FMax and FMin, a minimum of a maximum, and a product with one compare of its factors, as the RDNA forms
were already (`host_rdna` gives `host_float`'s bits there). The legacy product asks its factors whether
one is 0 even where they are bounded (`rdna::ZERO_SIGN`), so its zeros are the hardware's +0; Leonida's
legacy multiply-add keeps its spelled-out form there (its RDNA shortcut was checked on RDNA only).
`LEONIDA_HOST_FLOAT`: a set of the bits (1 max and min, 2 the legacy product, 4 med3, 16 the zero asked
of the factors); unset: all four; `0`: as before. Part of the translation: the shader cache keys on it.

The fork's measurements: on an RTX 4070 SUPER some programs ran several times slower in the spelled-out
forms (a gather of local lights 5.0 -> 1.2 ms, a tiled lighting pass 4.1 -> 0.2) depending on where the
system put memory, as a spilling program's would; on an RTX 3090 Ti 33.3 -> 33.9 frames a second.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64:
host_forms_give_what_the_spelled_out_ones_give on the card (13 forms, 169 cases each with zeros of both
signs, a subnormal, infinities and NaN: the same bits as the spelled-out forms), the legacy tests;
timed in a run of the game after this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 06:49:04 -05:00
1b83716379 Merge pull request #2455 from MoonEyes/feat/picture-metrics
tools: picture_metrics.py and the PICTURE block, numbers only from a frame on your disk (TOOLS-PICTURE-REPORT)
2026-12-01 12:48:22 +01:00
427aa19b69 Merge pull request #2231 from MoonEyes/tools/chain-check
tools: chain_check.py, one page of counts for the whole shader chain (TOOL-CHAIN-CHECK)
2026-12-01 12:46:48 +01:00
a726736ec2 Merge pull request #1774 from Tauwni/fix/explicit-lod-bias-moltenvk
rdna2spirv: --explicit-lod-bias applies the S# LOD bias where MoltenVK drops the sampler's; ps_ssharp passes on Macs (SHADER-EXPLICIT-LOD-BIAS-MVK)
2026-12-01 12:45:24 +01:00
13573d9252 Merge pull request #1519 from whoalin1/vk-fuzz-run-pctail
vk_fuzz_run: --pc-tail-ubo under LEONIDA_PC_TAIL_UBO, VK_FUZZ_SKIP_CRASH for driver crashes
2026-12-01 12:44:12 +01:00
a63eb958d9 Merge pull request #2843 from aznohonza/docs/boot-which-end
docs/boot.md: which end a late run ended in, read from the [rt] counters (DOCS-BOOT-WHICH-END)
2026-12-01 12:43:31 +01:00
21e6bbf4b9 Merge pull request #2671 from fiestorra/fix/amd-swizzle-numpy-late
amd_swizzle: validate arguments before needing numpy, and gate the tests the way the tool runs
2026-12-01 12:30:45 +01:00
4913ef152e Merge pull request #2436 from kawaii-shakal/wine-run-shader-cache
run_game_wine.sh: keep the drivers' shader cache from run to run (WINE-RUN-SHADER-CACHE)
2026-12-01 12:30:40 +01:00
d9df071e91 Merge pull request #1585 from whoalin1/nc-i16-clamp-nv
rdna2spirv: emit OpBitFieldUExtract for the VOP3 16-bit result mask (NVIDIA And-&-0xFFFF miscompile)
2026-12-01 12:30:35 +01:00
acaa1d69b4 Merge pull request #2672 from fiestorra/fix/tile-probe-numpy-gate
tests: four numpy gates decided in the wrong process, so their cases judged the exit code instead
2026-12-01 12:29:51 +01:00
8e8e5b3ed2 Merge pull request #2667 from fiestorra/fix/feature-scan-posix-only
tests: the two write-failure cases in test_feature_scan need preexec_fn, which Windows does not have
2026-12-01 12:29:37 +01:00
678d1fbc45 Merge pull request #2653 from fiestorra/fix/bench-baseline-threshold
tests: the local-baseline case does not measure CPU contention (macos-python's only red)
2026-12-01 12:29:21 +01:00
4baba68f2d Merge pull request #1733 from MoonEyes/tests/lds-src2-mc-stdin
test_lds_src2: feed llvm-mc through stdin, so a WSL LLVM_MC can read it (TEST-LDS-SRC2-MC-STDIN)
2026-12-01 12:29:07 +01:00
b13b6b3d3f Merge remote-tracking branch 'upstream/main' into HEAD 2026-12-01 19:17:10 +08:00
f613e6d8ea Merge remote-tracking branch 'upstream/main' into HEAD
# Conflicts:
#	scripts/merge_check.py
2026-12-01 19:13:49 +08:00
bf30e2585a Merge pull request #2764 from zmasi/perf/d3d12-gpu-list-lock-contention
d3d12: lock-free view publication and shared resource reads on list threads (D3D12-GPU-LIST-LOCK-CONTENTION)
2026-12-01 12:13:34 +01:00
ca75941984 Merge pull request #2750 from bobcatchris/perf/d3d12-shader-fast-hash
D3D12-SHADER-FAST-HASH: hash the translator's tables with a multiply hasher, not SipHash (-10 to -15 % of full-archive translate time)
2026-12-01 12:13:29 +01:00
3ee508b469 Merge pull request #2690 from bobcatchris/feat/d3d12-formats-bcpack-fast-lanes
D3D12-FORMATS-BCPACK-FAST-LANES: branchless AVX2 model lookup for BCPack rANS lanes
2026-12-01 12:11:31 +01:00
bf96444811 Merge pull request #2687 from bobcatchris/feat/d3d12-shader-opt-hoist-heap-handles
D3D12-SHADER-OPT-HOIST-HEAP-HANDLES: hoist uniform createHandleFromHeap out of branches and loops
2026-12-01 12:11:26 +01:00
beefb8927a Merge pull request #1880 from thiefyzheng/fix/texel-copy-fixedwidth
xg_xs copy_elements: dispatch fixed element widths 1/2/4/8/16 to a compile-time-sized copy loop (RT-TEXEL-COPY-FIXEDWIDTH)
2026-12-01 12:11:20 +01:00
393a31b462 Merge pull request #2697 from fiestorra/docs/agents-negative-control
docs: ask for a negative control and a checked instrument in AGENTS.md
2026-12-01 12:02:26 +01:00
e80995b9a8 Merge pull request #2188 from robot00f/docs/cpu-avx1-baseline-counts
docs(cpu_features): record baseline instruction counts and AVX1/SSE4.2 host delta
2026-12-01 12:02:09 +01:00
96d3ad2082 d3d12: switches.md lists LEONIDA_LIST_LOCK_FAST
Refs #2707
AI-assisted: yes
2026-12-01 02:57:12 -08:00
4501780d27 Merge remote-tracking branch 'origin/main' into perf/d3d12-gpu-list-lock-contention 2026-12-01 02:57:06 -08:00
19d62a98d4 Linux: enable scoped copy and descriptor tracking defaults (#2700)
* Linux: enable scoped copy and descriptor defaults

* Test Linux launcher optimization defaults and opt-outs
2026-12-01 11:52:20 +01:00
47fa73a566 runtime: make a missing return an error, not a warning (#2748)
* runtime: make a missing return on some paths an error

MSVC has two codes for a function that reaches its closing brace: C4716 whenthere is no return at all, already an error by default, and C4715 when somepaths return and others do not, which is a warning at the default warning level(measured: cl /EHsc alone reports it, /W4 is not needed). A change in this treedropped a return out; from a function with early returns, so it was C4715, andthe build stayed green. A full Release build of this commit reports none, sothe flag costs nothing today.

* runtime: keep /we4715 out of the assembler command

merzleckeier measured it on Windows Server 2025: add_compile_options
(/we4715) puts the switch on ml64's command line too, and MASM answers
'warning A4018: invalid command-line option : /we4715' - the same reason the
/utf-8 line above this one carries a COMPILE_LANGUAGE filter. Reproduced here:
unfiltered, one A4018 line from abi_probe.asm; filtered, none, and the C++
half still reports error C4715 when a return is removed.

---------

Co-authored-by: fiestorra <fiestorra@users.noreply.github.com>
2026-12-01 11:49:12 +01:00
c6c8f5f5a3 scripts: build llvm-mc 23.1.5 by default, so the pipeline library translates (#1923)
* scripts, tools: build llvm-mc 23.1.5 by default, so the pipeline library translates

LLVM 21.1.8's gfx1013 decoder cannot decode 840 of the 2,684 compute
programs in the pipeline library of 1.0.2.1: their listings carry 79,490
undecodable words and 8,310 exp invalid_target_N lines, the translator
refuses all of them as "fall-through into undecodable words", and the
shaders stage keeps 1,844 of 2,684. LLVM 21 does translate all 26,503
shaders of shaders.rpf; the library is what it loses.

The same bytes under llvm-mc 23.1.5 have no rejected word in those 840,
and 839 of them translate and pass spirv-val (the last wants s_sethalt,
which the translator does not implement, under either version). The 1,844
that already translated were re-disassembled too: 1,674 listings change
and all 1,674 still translate, the other 170 are byte-identical, so the
stage goes from 1,844/2,684 to 2,683/2,684.

The build helper now builds 23.1.5 by default. The docs that name the
minimum version (README, docs/design.md, docs/testing.md, docs/linux.md)
and the three user-facing messages that still said 21+ (make_game.py's
preflight, shader_disasm.py's probe error, mc_command.py's install hint)
now say 23+, with the tests that assert those texts updated.

AI-assisted (DeepSeek Harness).
Written with an AI assistant.

* docs: LLVM 23 is what the shaders stage needs, and a test pins the script's default
2026-12-01 11:48:54 +01:00
4902100668 d3d12_queue_wait_timeout: the same 60 s budget as d3d12_queue_wait (#761)
The control runs create_vulkan_device_standalone before it waits its 20 ms, so its TIMEOUT covers the whole device bring-up, exactly like the positive test above it (TIMEOUT 60). Under a parallel ctest that bring-up can pass 10 s, and CTest then kills the process: WILL_FAIL inverts an exit code but not a ***Timeout, so the negative control failed for a reason it does not control.

OLD-2970 / TEST-586

Co-authored-by: whoalin1 <207920491+whoalin1@users.noreply.github.com>
Co-authored-by: Gemini 4 Neon <noreply@google.com>
2026-12-01 11:48:32 +01:00
b121bc0bab ci: build and test the d3d12 Rust runtime on Windows (CI-D3D12-CARGO-TEST) (#2648)
* d3d12: min/max samplers honour filterMinmaxImageComponentMapping (D3D-994)

Without VkPhysicalDeviceSamplerFilterMinmaxProperties::
filterMinmaxImageComponentMapping, a minimum/maximum reduction defines
only the R component of a sample; G, B and A are undefined. The AMD
Windows driver on Polaris (RX 580) reports singleComponentFormats = 1
and imageComponentMapping = 0, and returns exactly that: R is correct,
G/B/A vary.

The layer now records the property in VulkanDeviceInfo and logs once
when it creates a reduction sampler on a device without it. The
descriptor test compares R only on such devices, and all four channels
where the device maps every component.

* d3d12: say when the driver's pipeline cache stops keeping new pipelines (RT-PIPELINE-CACHE-GROWTH-STALL)

A driver can stop adding to a large VkPipelineCache with no error. On NVIDIA 610.88 a 1.23 GB or 1.35 GB cache
came back the same size to the byte after a 2 s compile, so the next run compiles the same pipelines again and
nothing says why. The runtime now takes the cache's size at creation and at each session save, counts the title's
pipeline builds that took at least 200 ms, and logs once when 16 or more compiled while the cache grew less than
64 KiB. pipeline_cache_store_test covers the decision; docs/d3d12_vulkan.md records the measurements.

* docs: rewrap the pipeline cache growth paragraph (RT-PIPELINE-CACHE-GROWTH-STALL)

* d3d12_xs: say so when LEONIDA_D3D12=vulkan is asked of a runtime built without the Vulkan device (RT-VULKAN-REQUESTED-NOT-BUILT)

A gta6rt configured without Vulkan headers is built without
LEONIDA_VULKAN_DEVICE. D3D12XboxCreateDevice then ignored
LEONIDA_D3D12=vulkan without a word and wrapped the host's D3D12 device,
so a run stopped somewhere else and read like a boot result.

It now prints one [rt] d3d12_xs line naming the cause and the configure
options. Which device is created does not change. The reading of the
variable moves to shims/d3d12_backend.h, used by both builds; new CPU-only
test d3d12_backend, registered outside the Vulkan-headers block.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* d3d12: frame-time percentiles and what stalls frames, in the log and on the panel (D3D12-FRAME-TIME-STATS)

The frame-rate line gives a mean over the last second or more, and the F3
panel only the longest frame, so a run with smooth frames and a few
multi-second stalls looks like a slow one, and the stalls do not show.

host/frametime.rs keeps every presented frame's time. With the frame-rate
line, every five seconds, it logs one line: the median, 95th and 99th
percentiles (nearest rank), the longest frame, how many took over 100 ms
and over a second, and beside them host pipelines queued and made a second,
waits for new memory to be resident per frame, and the commit the system has
left. The panel shows the last line's numbers and the pipeline wait per
frame. Pure parts are unit-tested.

* d3d12: frame-time panel lines fit long stalls, the first line counts from the first present (review)

- Panel: frame times of 10 s or more (the launcher's pipeline budget) made
  the percentile line longer than 40 columns, and the panel cut it without
  a sign ("MAX 10000" showed as "MAX 100"). Times from 10 s up are shown in
  whole seconds ("10S"); the test covers 10 s, 100 s and 10 min.
- The first line's pipelines made a second and residency waits counted
  everything since the process started: the meter now starts from the
  totals at the first present.
- "queued" was queued or being made: the log says so, the panel says
  PIPES PENDING.
- The nearest-rank test covers 95% of 100 frames, where a float ceil would
  take the 96th.

* d3d12: a pipeline a frame waits for goes before those asked for earlier (D3D12-PIPELINE-WAIT-QUEUE)

A draw whose host pipeline is not made queues it at the back of the
requested list, and its frame then waits for it up to the frame's budget.
On the first visit to the world about 1,700 pipelines were queued at once,
562 of them took over a second each, and with the launcher's 10 s budget
every frame waited the whole budget for a pipeline a thousand others stood
before, then dropped its draws anyway: 0.35 fps for three and a half
minutes (RTX 3080, 8 workers).

A new queue state, AWAITED, sits between REQUESTED and MAKING. When a frame
starts waiting for a pipeline that is still in the queue, the entry moves
to the front of its list (passes over the screen in theirs), after those
awaited before it, so the next free worker makes it. It moves at most once,
is never claimed twice, and WAITING does not count it again; makes already
running are not interrupted. LEONIDA_PIPELINE_AWAIT_FIRST=0 keeps the order
asked.

Frames on a cold cache still wait up to the frame's budget: the waits now
succeed, so a frame may spend its budget on several pipelines it then draws
instead of one it drops. The budget setting bounds that, as before.

* ci: build and test the d3d12 Rust runtime on Windows (CI-D3D12-CARGO-TEST)

No workflow ran the d3d12/ workspace tests. This adds one on windows-latest for changes under d3d12/: build, then cargo test as the gate (no GPU, no game data). The xtask asset-policy test and clippy -D warnings both fail on main today (two sources over the 640 KiB limit; about 25 clippy findings), so they run as reports until fixed. cargo fmt is left out: it would reformat most of the tree under the open d3d12 pull requests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* d3d12: a frame's pipeline wait counts the queue lock its promotion waits for (review)

wait() started its timer after promote() took the queue's lock, so time
spent waiting for that lock came on top of the frame's budget: in a
synthetic contention test (queue held 240 ms, 80 ms budget) a frame waited
320 ms. The timer now starts before the promotion, so the lock delay is part
of the budget (240 ms in the same test, the lock holder's time itself).
Reported with the test by merzleckeier.

* ci: d3d12 workflow follows TheGeogeo's review

mods/** in the paths (leonida-lua's tests read mods/example_lua), a build with the features people run, the replay
test of leonida-gpu (diagnostics), a cache of Cargo's downloads, a limit on the test step. d3d12/.github/workflows/ci.yml
is removed: GitHub runs workflows only from the repository's root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: skip the depth bounds test on the runner's software adapter until #2663

It is the only failure of the job, and it hides the crates after leonida-gpu and the replay test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Zilumz1 <221744236+Zilumz1@users.noreply.github.com>
Co-authored-by: Galaxy <jojomalrbx@gmail.com>
Co-authored-by: quartz-heron-58 <245169279+quartz-heron-58@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: OreoFR <29048345+OreoFR@users.noreply.github.com>
Co-authored-by: Galaxy <23423870+thegalaxydev@users.noreply.github.com>
Co-authored-by: TheGeogeo <57634077+TheGeogeo@users.noreply.github.com>
Co-authored-by: MoonEyes <14891700+MoonEyes@users.noreply.github.com>
2026-12-01 11:43:23 +01:00
c77b84e3a0 D3D12-CLIPPY-LEONIDA-GPU: fix all 52 clippy warnings in leonida-gpu (#2682)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-12-01 11:39:04 +01:00
c53cf975c5 D3D12-CLIPPY-NON-GPU-CRATES: fix all 31 clippy warnings outside leonida-gpu (#2681) 2026-12-01 11:38:45 +01:00
4009a3426d Merge pull request #1659 from whoalin1/snan-fma-cmpclass
fmisc_diff: do not judge the class bits of a NaN whose quiet bit is unmodelled
2026-12-01 11:31:31 +01:00
653f60d37e Merge pull request #2699 from bobcatchris/feat/d3d12-gpu-shadow-avx2-merge
D3D12-GPU-SHADOW-AVX2-MERGE-AND-RUNS: AVX2 fast paths for shadow merge, back_piece, and changed_runs
2026-12-01 11:18:41 +01:00
da56079c9e Merge pull request #2689 from bobcatchris/feat/d3d12-gpu-changed-records-avx2
D3D12-GPU-CHANGED-RECORDS-AVX2: add AVX2 fast path for 32-byte descriptor changed_records
2026-12-01 11:07:51 +01:00
3cd5de60bf d3d12-loader: console_insn range checks don't overflow at the top of memory
readable() and writable() computed va + bytes (and BaseAddress +
RegionSize) unchecked. They run inside the vectored exception handler,
where a clzero with RAX near the top of the address space made the
debug build panic with an overflow (taking the process down) and let a
wrapped end pass the range check in release. A range that runs past the
top is now neither readable nor writable, and such a clzero is left to
fault as it would.

After ahmetbagci's fix in TaynanGT/Vice-Tay (c2f2b5b); its write_sites
half is already in #2664.

Co-Authored-By: ahmetbagci <6625856+ahmetbagci@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 11:03:36 +01:00
3393ceec9c Merge pull request #2696 from bobcatchris/feat/d3d12-gpu-texback-reuse-before
D3D12-GPU-TEXBACK-REUSE-BEFORE: reuse thread-local before buffer in texback::write
2026-12-01 10:51:22 +01:00
0259473b0b Merge pull request #2695 from bobcatchris/feat/d3d12-formats-texture-fast-walk
D3D12-FORMATS-TEXTURE-FAST-WALK: 1.22x-1.74x faster Layout::detile & tile via pre-divided u32 chunk offsets
2026-12-01 10:35:21 +01:00
6da607c096 scripts: --help on the Python and shell entry points
check_no_game_data.py read `--help` as a path and answered "cannot read --help", exit 2, in the tool every
contributor is told to run; it now prints the usage text it already carries and exits 0. play-linux.sh and
run_wine_session.sh print their usage before any environment check, where they used to answer with an error
(and play-linux.sh's no-argument case still prints the same usage, on stderr, exit 2).

run_game_wine.sh's one-line Usage line names the required --shaders, which its Inputs section already listed.

A test per script fails on main's copies and passes here.
2026-12-01 10:29:39 +01:00