Commit Graph

5744 Commits

Author SHA1 Message Date
dd4c763c11 Docs: the SCC row covers s_min_i32 and s_max_i32 2026-11-21 18:54:42 -04:00
e444c83335 GPU test for the S# and T# mip fields through gfx10_descriptors.h
vk_sampler_test binds a 128x128 two-level texture with the VkSampler from
vulkan_sampler(decode(S#)) and the view range from decode(T#). ps_ssharp
samples it with image_sample_lz and image_sample. check.py judges eight
S#/T# cases per pixel against levels worked out from the S# and T# bits.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:53:51 +01:00
fe8cd6bc72 Tools: reject out-of-range --start/--limit in RPF index tools
Adds the #283 argparse validators to anim_index, rbf0_index, restofworld_index and rpf9_carve: --start >= 0, --limit >= 1 (decimal or 0x hex), and --max-inflate >= 1 in restofworld_index. Bad ranges now exit 2 before any scan or output instead of silently scanning everything, less, or nothing. Synthetic CLI tests in all four test files; docs notes for each tool.

New item claimed in #156. AI-assisted (OpenCode).
2026-11-21 16:53:41 -06:00
75e666e615 Runtime: convert UINT render-target clear values numerically 2026-11-21 18:53:21 -04:00
4d18ef9d62 Merge branch 'main' into fix/rdna2-float-to-int-saturation 2026-11-21 23:51:23 +01:00
307d5e4c1a Docs: a guide to running the GPU tests
Collects what testers in #166 needed to find out themselves: llvm-mc
with the AMDGPU target per OS, building the test programs, the two ways
to run the suite, wave64 emulation on 32-wide GPUs (set
LEONIDA_W64_EMULATE for build.py too), choosing a GPU, and the problems
reported so far with their fixes. Linked from CONTRIBUTING.md and the
docs index.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:50:59 +01:00
0b2ca369c2 Gather address modes: emit only the needed code, document FORCE_UNNORMALIZED, discriminating tests
A literal S# mode emits only its own wrap/mirror/mirror-once code (no dead
chains); a run-time S# still selects among all four. The S# value mapping now
cites Mesa gfx6.json and RADV radv_tex_wrap. FORCE_UNNORMALIZED on a run-time
S# is not applied (not confirmed on hardware, so not guessed): documented as
the second remaining approximation. Tests cover all 16 literal x/y mode pairs
with per-axis op counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:50:47 +01:00
526e123878 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:48:49 +00:00
b262056ac7 Tools: measure the common.rpf content-set graph
Add gamedata_graph.py, which rebuilds the XML payloads from a carve and measures document -> content-set -> target edges. Include ids are joined only on exact equality; missing ids stay dangling and common:/ is not normalized to $(common)/.

Add synthetic tests for includes, a cycle, reachability, prefix classification, unparsed payloads and output redaction. Add a measured docs page linked from the index.
2026-11-21 22:47:26 +00:00
8bd0087d2d docs: full-corpus pipeline build: 26,503 of 26,503 shaders compile on NVIDIA, 3.81 GB pipeline cache
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:46:23 -05:00
3dd8007237 translator: whole-quad mode (s_wqm_b32/b64) on lane masks and data (SHADER-34)
s_wqm on EXEC/VCC/an SGPR mask is no longer the identity: the lane ORs its
bit with its quad's (two OpGroupNonUniformQuadSwap, or four x_buf reads under
--wave64-emulate), SCC is the wave-wide any. Data operands compute the quad
bits directly. GPU tests cs_wqm_w64, cs_wqm_w32, ps_wqm; design.md row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:45:36 +01:00
80fb7f2e41 Textures: add clean-room BCPack decoder (rANS + BC1/BC3/BC4/BC5) 2026-11-21 14:44:27 -08:00
2442ad124a tests/docs: follow this round's both-side merges (shader_profile test uses #263's run_profile, drop duplicated table rows)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:42:27 -05:00
ce1eb6ae85 Merge latest Leonida main into class compare fix 2026-11-21 23:42:07 +01:00
44a94f35ca Runtime: widen enhanced-barrier stages so every access has a stage that can perform it
D3D12 lets an access be named with a sync scope whose Vulkan stages cannot perform it:
SYNC_ALL_SHADING with ACCESS_VERTEX_BUFFER is valid D3D12, but VERTEX_ATTRIBUTE_READ needs
VERTEX_ATTRIBUTE_INPUT. Vulkan rejects such barriers (docs/d3d12_vulkan.md listed it as a known gap).

vulkan_barrier_scope maps each side of a global, buffer or texture barrier and adds the narrowest
stage that supports any access left without one (the synchronization2 "supported access types"
table). The access is never dropped, so the dependency still covers everything the application
named. CLEAR only writes, and ALL_GRAPHICS holds no transfer stage, so transfer reads get ALL_TRANSFER.

vk_command_replay_test part D records all 360 D3D12 sync/access pairs as global, buffer and texture
barriers: 462 validation errors before, 0 after, on Intel(R) Graphics. d3d12_state_map_test checks
that stages only grow, accesses never change, and pairs Vulkan already accepts are left alone.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:42:05 +01:00
4d010bf4bd Merge pull request #176 from Spaghetih 2026-11-21 17:38:46 -05:00
fafcc4197b Merge pull request #284 from S1m0ne1997
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-21 17:38:43 -05:00
30ad4802c4 Merge pull request #298 from AlxcBTW
# Conflicts:
#	docs/design.md
#	tests/test_translate.py
2026-11-21 17:38:35 -05:00
8183bb5610 Merge pull request #272 from LuanFreitas
# Conflicts:
#	docs/design.md
#	tests/test_translate.py
2026-11-21 17:38:33 -05:00
b779cc17e1 Merge pull request #301 from Shuvam Pandey 2026-11-21 17:38:32 -05:00
eaea09434b Merge pull request #274 from SuarezPM 2026-11-21 17:38:31 -05:00
1c62e91b1a Merge pull request #261 from Tim Elery 2026-11-21 17:38:24 -05:00
263fcbdba8 Merge pull request #270 from nicolas 2026-11-21 17:38:23 -05:00
09cee3344b Merge pull request #283 from Diego Casares 2026-11-21 17:38:21 -05:00
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
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
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
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
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
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
ac3bf8ae79 Document RDNA2 conversion in the translator contract 2026-11-21 23:29:48 +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
b384056741 Docs: record the TTPF array/volume measurements in the design row 2026-11-21 22:25:33 +00: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
27d1b11b64 Runtime: register each mapped image's x64 unwind table (.pdata) with RtlAddFunctionTable
Images the loader maps by hand are unknown to the system unwinder, so an exception raised in or passing through one couldn't be dispatched and killed the process. load() now validates the exception directory (entries in bounds, sorted, non-overlapping; zero-length entries allowed, as in System32's symcryptk.dll) and registers it; the loader removes it before freeing the image. Rules measured over 3,780 x64 System32 images (5,023,071 entries) and the 16 package DLLs.

Tests: loader_test covers registration, removal and six corrupt tables on hand-built images; pe_loader_test checks a fixture SEH fault is caught by the image's own handler (fails without registration) and, with LEONIDA_GAME_DIR, every package DLL's table.

AI-assisted.
2026-11-21 23:18:59 +01:00
fece829131 docs: measure TTPF array and volume layouts (ASSET-18) 2026-11-21 22:17:49 +00:00
edbef47811 Docs: census other world archives for placement maps 2026-11-21 22:16:20 +00:00
fdf4d29955 Translator: use the FSSM pixel-input table in the PS input path (SHADER-15)
AI-assisted (fixer lane, orchestrated). tools/fssm_header.py already decoded the pixel-input table; rdna2spirv.py ignored it.

- PS translate() reads the fssm/<name>.fssm sidecar (same convention as CS) and declares every table position 0..count-1 as a fragment input at that Location, including positions the code never reads.
- A 32-bit v_interp read (p1/p2/mov) of a 16-bit-flagged position (flag bit 4) is rounded f32->f16->f32; *_f16-opcode reads already narrow and are unchanged; reads past the table still declare; no sidecar (or empty table) is byte-identical to the old path.
- shader_meta() records ps_interpolants (count) and ps_fp16_interpolants (flagged positions).
- docs/design.md: contract-table row with corpus measurements and the fixture confirmation (synthetic + mini_interp, no GPU).

Verified: tests/test_rdna2spirv_pixelinput.py 9 passed (synthetic FSSM blobs + hand-written listings, empty DXBC; no llvm-mc/spirv-tools/GPU/game data); full suite 1066 passed + 366 subtests on the dev branch; compileall + make_game --help green. Claimed as SHADER-15 in #156 before starting.
2026-11-21 19:15:52 -03:00
c56589c91b SHADER-30: emit CullPrimitiveEXT as Block+bool for old spirv-val
Array-of-bool is legal (VUID-07036) but SPIRV-Tools <=2025.1 rejects it (#5980).
The Block member form matches glslang and passes both old and new validators.
2026-11-21 19:14:58 -03:00
052cc571d0 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:12:07 +01:00
c9a3798c5f Docs: put the measured levels census in the archive row 2026-11-21 22:10:11 +00:00