Commit Graph

18350 Commits

Author SHA1 Message Date
6da439da0f Merge pull request #289 from Ayinaki 2026-11-21 17:38:21 -05:00
8cd141e5a3 Merge pull request #305 from Kam471 2026-11-21 17:38:20 -05:00
a15ed8817d Merge pull request #292 from Kam471 2026-11-21 17:38:20 -05:00
5a499f2598 Merge pull request #285 from Kam471 2026-11-21 17:38:20 -05:00
9db1ab28c0 Merge pull request #273 from Kam471 2026-11-21 17:38:20 -05:00
9eac62dce9 Merge pull request #266 from Kam471 2026-11-21 17:38:20 -05:00
83d1ce8a7b Merge pull request #264 from Kam471 2026-11-21 17:38:20 -05:00
b08051bcbc test_feature_scan: run as a pytest test as well as a script (pytest collection hit the module-level sys.exit)
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:38:14 +01:00
1f48889812 d3d12_vulkan.md: the translator's uses_code_base confirms the per-stage code-base counts
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:38:14 +01:00
aa0d8a8ba7 fix: report unsupported two-mip Vulkan devices
Return the established skip code for unavailable graphics capabilities so unsupported hardware yields a distinct test result. Preserve failures for Vulkan allocation and enumeration errors.
2026-11-21 23:38:08 +01:00
e8a07da4ff feature_scan: count s_getpc_b64 kept for code-embedded data per stage; d3d12_vulkan.md: answer §8.2 #10, per-stage counts for #14, tiled resources for #18
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:38:02 +01:00
40a7edaef3 world_census: reject --shard-size and --jobs below 1
--shard-size 0 (or a negative size) never finished planning shards: pos
never advanced, so the list grew until memory ran out. --jobs 0 crashed
with a ValueError traceback from ProcessPoolExecutor.

Both flags now take a positive_int, so argparse exits 2 with "must be at
least 1". _expected_shards also raises ValueError for a size below 1, for
callers that skip the CLI.

Tests: the CLI cases run in a subprocess with a timeout, and the planner
case counts additions, so a regression fails instead of hanging.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:38:00 +03:00
eef019d7ba Keep clip regressions alongside the merged bindless texture check 2026-11-21 14:37:58 -08:00
321635899b Tools: feature_scan.py, a corpus scan for D3D12-layer features (SHADER-16)
Counts, from what the shaders stage leaves in <work>/shaders, the features docs/d3d12_vulkan.md
§8.2 #10 and #14 ask about: the DXIL program kind of every shader (hull, domain, amplification),
the SFI0 D3D_SHADER_REQUIRES_* flags (values from the Windows SDK's d3d12shader.h, among them
WAVE_MMA and SHADING_RATE), output-signature streams other than 0, native v_mfma/v_wmma and
GDS/ordered-count instructions in the disassembly, and uses_code_base per stage from
spirv/index.json. Prints counts only. tests/test_feature_scan.py checks it on a synthetic work
folder (hand-built DXBC parts, listings and index).

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:37:43 +01:00
ccb001882f Docs: measure the BCPack block structure and limits
Record the 48-byte lane header, block counts, the exact BC1/BC4 constant-lane check, and the 200-chunk entropy convergence. A public BC1 candidate is mip-consistent on 40/200 chunks but has no byte-exact plaintext check and an unpublished predictor window, so no decoder is added. Also record that no shipped DLL contains a BCPack/BCn/DStorage decoder or dispatcher.
2026-11-21 22:37:31 +00:00
83d0637267 runtime: the D3D12 COM library links d3d12_xs_device.cpp (#224 needs the device behind the proxy); xgameruntime reads LEONIDA_DEVICE_TYPE with GetEnvironmentVariableA (C4996)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:36:45 -05:00
5bc48f20b7 world_names: resolve placement/archetype hashes with 32-bit joaat and Murmur3-64
Measured on Xbox 1.0.2.1:
- archetypeName, map name and parent are lower-cased joaat.
- per-archetype +0x20 and map +0x10 keys are MurmurHash3 x64 128 low 64 (seed 0).
- +0x08 is a per-entity id, not a per-archetype hash.

A 79,738-name local dictionary resolves 5,107/24,105 distinct
archetype hashes (8,263/203,799 entities) in two bounded windows,
all confirmed by the 64-bit key; one 32-bit-only candidate is
rejected. Map names resolve 5/23,535 and parents 1/2,089.

Adds tools/world_names.py, synthetic tests, world_names.md, and
map_name64 to world_index output.
2026-11-21 22:36:32 +00:00
f2df1ed542 Translator: image_gather4_l applies the S# address mode at the border (SHADER-36)
The four-fetch emulation of image_gather4_l(_o) clamped every texel to the
edge. Each coordinate now goes through the S#'s CLAMP_X/CLAMP_Y (wrap, mirror,
clamp to last texel, mirror once), read at translation time from a literal S#
and from the SGPR at run time otherwise. A literal S# with a border mode or
FORCE_UNNORMALIZED is Unsupported.

GPU test ps_gather_wrap (vk_texture_test) with hand-derived expected values;
wired into check.py, scripts/run_gpu_tests.py and tests/test_shader_checks.py;
pytest cases in tests/test_translate.py; docs/design.md row updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:36:09 +01:00
fa8beb755a Translate v_cmpx_class_f32 as an EXEC-only compare 2026-11-21 23:35:42 +01:00
7c33beedc1 tests: compare resolved paths in test_run_gpu_tests_paths (Windows spells the temp dir RUNNER~1) 2026-11-22 00:35:31 +02:00
ce41eba4f7 Merge current main and preserve distinct mesh and clip harness modes 2026-11-21 14:33:12 -08:00
89b74d8e40 Add the hand-written RDNA2 conversion shader 2026-11-21 23:32:57 +01:00
23f5a514e9 Remove duplicate tests/test_float_to_int.py from the test root 2026-11-21 23:32:43 +01:00
7f7e94c595 Remove duplicate tests/spirv_mini_interp.py from the test root 2026-11-21 23:32:39 +01:00
ea76a12267 tests: preflight tests follow their faked PATH for #223's .NET SDK check (no real dotnet needed)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:32:33 -05:00
70ae4c0eb4 Remove duplicate tests/regen_fixtures.py from the test root 2026-11-21 23:32:12 +01:00
2c3f21738e Remove duplicate documentation uploaded to the root 2026-11-21 23:31:57 +01:00
6516dfea46 fix(tools): report clear errors for empty, short and out-of-range input
BUILD-30: anim_index, rbf0_index and restofworld_index now reject an
empty archive with a named error instead of mmap's traceback.
rpf9_carve rejects an empty or shorter-than-header archive and a
--start at or past the file size before it divides by the span.
audio_config exits with a named error when the input has no records
instead of formatting None as a hex id.

The new synthetic test covers every case; the existing tests for the
five tools still pass.
2026-11-21 23:31:48 +01:00
e19df2b0d4 make_game.py: read vulkaninfo's subgroup size per device; vk_subgroup_info.py refuses 32-bit Python
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:31:41 +01:00
d798c76853 test: distinguish explicit mip zero from implicit minification on Vulkan
A single-level view produces the same image for both sampling operations. Exercise both against the same minified view so the readback detects a wrong LOD or swapped texture coordinates.
2026-11-21 23:31:25 +01:00
71b0122c19 Add the generated disassembly for the synthetic shader 2026-11-21 23:31:07 +01:00
b33cfa9e8c pe_inspect.py: report a truncated image instead of stopping the run with struct.error
A file cut off inside the optional header, the export directory, the TLS directory or an import lookup table
raised struct.error. main() catches only PeFormatError and OSError, so a run over several images ended in a
traceback at that file and the rest were never inspected. The optional header's fixed fields are now
length-checked, and inspect() turns any remaining struct.error into PeFormatError, which main() reports as
"not a PE image (...)" before moving on.

The two export loops also ran to NumberOfFunctions / NumberOfNames as read from the file, so a corrupt count
near 2^32 kept a run busy indefinitely. They are now capped at MAX_ENTRIES like the import, thunk and TLS
loops, whose comment already says that is what the cap is for.

Tests: TruncatedImageTest in tests/test_pe_inspect.py (each table cut short, a sweep over cut lengths for
PE32 and PE32+, a CLI run that keeps going after a truncated file, and a 0xFFFFFFFF export count).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:31:03 +03:00
a638c5acb9 Cache seeded choices in the CFG structure test 2026-11-21 23:30:58 +01:00
b9552cd924 Translator: convert cube sample coordinates for the 2D-array view
The hardware takes a cube sample's s and t in [1, 2] and its third
coordinate as 8 * slice + face (Mesa ac_nir_lower_tex_coords.c, LLPC
ImageBuilder.cpp). Samples and gathers passed them unchanged to the
6-layer 2D-array view; they now use s - 1, t - 1 and layer
6 * slice + face.

ps_cube_sample checks every pixel on a GPU (vk_texture_test cube), and
test_cube_sample checks the coordinates without one.
2026-11-22 04:15:43 +05:45
c29faa4899 Add bit-exact CPU regression coverage under tests/semantic 2026-11-21 23:30:27 +01:00
ac3bf8ae79 Document RDNA2 conversion in the translator contract 2026-11-21 23:29:48 +01:00
e6cf90f963 test_feature_scan: run as a pytest test as well as a script (pytest collection hit the module-level sys.exit)
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:29:24 +01:00
55459fa124 run_gpu_tests: ps_texture_sample with a relative --build or a --filter
vk_texture_test runs with its working directory in <work>/spirv, so a relative --build (runtime/build) made the
tool path point there and the test failed with "missing runtime/build/vk_texture_test". --build and --work are
now made absolute after parsing. A filtered run also builds vs_ids.spv for ps_texture_sample, which
vk_texture_test loads, as #192 did for ps_flat (one table, DRAWN_WITH).
2026-11-22 00:29:12 +02:00
a831d1a548 Test saturated conversions in the SPIR-V interpreter 2026-11-21 23:28:11 +01:00
6bb3b5330a Document RDNA2 float-to-int saturation semantics 2026-11-21 23:27:57 +01:00
bd27a74315 Decode the MHIU and PAMH map arrays
Add a stdlib reader for the two MHIU headers and square byte grids and the PAMH row table plus u16 grid, with synthetic tests and measured header notes. The checksum and the MHIU prefix remain unknown.
2026-11-21 22:27:43 +00:00
a2e41646c8 GPU tests: report a test program Windows refuses to start, not a traceback
On Windows 11, Smart App Control blocks freshly built unsigned programs it
has no reputation for (WinError 4551, "An Application Control policy has
blocked this file"), and which ones it blocks changes with each rebuild.
run_gpu_tests.py then stopped the whole run with an OSError traceback, and
check.py did the same from mesh_w64x_test.

- check.start_failure() turns the OSError into one result line naming the
  program and, for the Windows refusals (4551 Application Control, 1260
  software restriction policy, 225 Defender), who refused it and how to
  allow it.
- check.run(), mesh_w64x_test(), run_gpu_tests.run_cmd() and the
  ps_texture_sample launch report it as a FAIL of that test and go on with
  the rest. It is a failure, not a SKIP: a blocked run must not look green.
  pixel_test() passes the reason on instead of "vk_harness failed".
- A missing program still stops check.py with the build instructions.

tests/test_gpu_blocked_program.py fakes the error, so it runs on any OS.

AI-assisted (Claude Code). Tested on Windows 11 Home, NVIDIA GeForce RTX
4060 Ti (driver 32.0.16.2124), on main 36ace71:
- the new tests: 7/7 on Windows and on Linux (WSL Ubuntu 26.04); 5 of
  them fail without the fix
- end to end, with test programs Windows really refuses (WinError 216):
  run_gpu_tests.py and check.py print one FAIL line per test and exit 1,
  no traceback
- run_gpu_tests.py: every PASS/SKIP identical to main, natively (29/49,
  20 skipped) and with LEONIDA_W64_EMULATE=1 (47/49, 2 skipped); ctest
  12/12; tests/test_*.py all pass; tests/semantic 388 OK

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 16:26:33 -06:00
c6138d9bc2 Match RDNA2 saturating float-to-int conversions 2026-11-21 23:26:31 +01:00
b384056741 Docs: record the TTPF array/volume measurements in the design row 2026-11-21 22:25:33 +00:00
738192451a tests: keep_emulated follows auto only
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:25:02 +01:00
94ff4c9da9 Merge remote-tracking branch 'origin/main' into test19-vcc-x2-gpu
# Conflicts:
#	runtime/test/shaders/check.py
#	runtime/test/vk_harness.cpp
#	scripts/run_gpu_tests.py
#	tests/test_shader_checks.py
2026-11-22 00:24:49 +02:00
9e81de4233 d3d12_vulkan.md: the translator's uses_code_base confirms the per-stage code-base counts
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:24:43 +01:00
76b7b5b329 Index tools: refuse --limit/--start values that scan nothing, survive empty archives
bvh_index, page_index, story_index, navmesh_index and psin_index:

- --limit 0 meant "no limit" (0 is falsy) and a negative --limit scanned
  nothing and still exited 0 with an empty index. --limit must now be at
  least 1 and --start 0 or more; argparse rejects anything else (rc 2).
- An empty .rpf crashed in mmap ("cannot mmap an empty file") and a file
  shorter than the header word crashed in struct.unpack_from. bvh, page and
  story now treat both as an archive with no streams.
- bvh_index directory mode: one bad archive no longer aborts the scan and
  loses the results of the others; it is reported and skipped.
- A --start past the end of the archive is a one-line error (rc 2) instead
  of a traceback (bvh also checked nothing and reported a negative span).
- page_index checks the output extension before the scan, not after it.

Docs: the accepted ranges and the empty-archive behaviour are written next
to each tool's usage in docs/{bvh,navmesh,page_directory,psin,story}.md.

Tests: synthetic cases for each tool; they fail on main and pass here.
2026-11-21 23:21:29 +01:00
1d645c64e9 tests/semantic: run OpIAddCarry in the interpreter, and test the carry chain
spirv_mini_interp.py had OpISubBorrow but no OpIAddCarry, so no carry-out add
(v_add_co_u32, v_add_co_ci_u32, s_add_u32, s_addc_u32) could be run.

test_carry_chain.py checks the result and carry-out of v_add_co_u32,
v_sub_co_u32, v_subrev_co_u32 and their _co_ci forms (e32 through VCC, e64
through SGPRs), and of s_add_u32/s_addc_u32 and s_sub_u32/s_subb_u32 through
SCC, at the carry and borrow boundaries. It also checks the 64-bit add and
subtract built from each pair. test_interp.py tests OpIAddCarry directly.
2026-11-21 19:20:59 -03:00
b946e90ba2 make_game.py: wave64 mode survives a kill after the merge; auto keeps emulated shaders; stricter auto detection
- The mode file is written before the translation starts (index.json is absent
  then), not after it: a stop between the merge and the old write left an index
  with no mode, which counted as "off" and either re-translated hours of work
  or passed emulated shaders off as native.
- auto keeps shaders that were translated with emulation when this run would
  not emulate (a GPU asleep or hidden, vulkaninfo missing): they are exact on
  every GPU. An explicit --wave64-emulate off still translates natively.
- auto turns emulation on when tools/vk_subgroup_info.py says the runtime's GPU
  can't be made to run compute and mesh 64-wide (subgroupSizeControl, both stage
  bits: vk_pipeline_check's can_require_sg); it never turns it off.
- smallest_max_subgroup gives None (unknown, so on) when a device prints no
  subgroup size instead of leaving it out of the minimum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:20:19 +01:00